Skip to content

How to handle partial writes to a network socket? #821

Closed Answered by redbaron
redbaron asked this question in Q&A
Discussion options

You must be logged in to vote

I'd recommend, do a normal non-blocking socket and just issue sends. io_uring will internally poll the socket for you if needed. There might be merit in polling if you're streaming (in contrast to more of a ping pong pattern) and running out of space in tx queues.

assuming TCP connection hangs and no remote peer ACKs can be received. socket sendbuffer is 64kb and it is currently empty, we submit send op for 128kb buffer on a normal socket with no additional flags, what will happen?

  1. CQE with 64 kb
  2. we submit another send op for remaining 64kb
  3. CQE with 0 kb

Or

  1. CQE with 64 kb
  2. we submit another send op for remaining 64kb
  3. io_uring blocks and never returns CQE for the second write

Or

  1. io_u…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@isilence
Comment options

@redbaron
Comment options

Answer selected by redbaron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants