Linux Buffered Sockets Size

Are there any simple functions to check how much data is buffered but unread? FD_ISSET indicates only the presence of data in the buffer. Is it possible to create a second buffer in the program for more control over the buffer?

+3
source share
1 answer

You can use recv()with flags MSG_PEEKand MSG_DONTWAIT, but there is no certainty that in this case there will be no more bytes than recv().

Using a buffer in your program is a normal and acceptable way to solve a problem.

+6
source

Source: https://habr.com/ru/post/1757438/


All Articles