admin管理员组

文章数量:1392105

I'm trying to see if u_ring can be used for networking. So far, nothing works.

Here is what I'm trying... I have a simple TCP/IP server that should receive some data from a client. That server is using liburing.

Basically I do this:

I use io_uring_register_buffers(); to register 10 buffers, each 4096 bytes long. It is actually one contiguous buffer, so I provide different offsets while registering. After calling listen() on the socket I prepare an accept request with io_uring_prep_accept() and I submit it successfully. Once a client connects, io_uring_wait_cqe() returns a CQE, while handling it I also do io_uring_prep_recv_multishot() and I submit it, successfully. According to the documentation, io_uring_prep_recv_multishot() expects zero for the length, which I passed. Btw, before submitting a multishot request, I also do this:

sqe->flags |= IOSQE_BUFFER_SELECT; sqe->buf_group = 0; // Group ID 0

The second CQE that I receive is the multishot one (accept was the first one). But, this CQE carries failure. The res is -105, which means "No buffer space available". At the same time the connected client sends data, but I cannot retrieve it no matter what.

I'm not able to find some meaningful documentation on all this, so if anyone can help, I would appreciate it.

本文标签: linuxCan we use iouringregisterbuffers() with iouringpreprecvmultishot()Stack Overflow