If the return value of read() is the same as the buffer size, how do I read the rest of the information? If read is invoked again, will it read the next chunk of data, or read from beginning again, or is the information not read into the buffer permanently lost?
Share
On a TCP (SOCK_STREAM) socket, you get the next chunk of data. Reading from TCP sockets are analogous to reading from a file.
On a UDP (SOCK_DGRAM) datagram socket, if your buffer isn’t sufficient to consume the entire datagram, you lose the rest of the datagram. A subsequent read will consume the next datagram that arrives.