Linux socket buffered data size
Is there an开发者_C百科y simple functions to check how much data is buffered but unread? FD_ISSET only indicates the presence of data in the buffer. Is possible not to create a second buffer in the program for greater control of buffer?
You could use recv()
with the MSG_PEEK
and MSG_DONTWAIT
flags, but there's no firm guarantee that there aren't more bytes available than recv()
returned in that case.
Using a buffer within your program is the normal and accepted way to solve the problem.
精彩评论