I have program which allocates a 32-bit int and subsequently tries to read 4 bytes from a socket into the int using read(2)
Sometimes the read is incomplete and returns having read say 2 bytes. Is there any way of recovering from this? I suppose I have to produce a pointer halfway into the int to be able to perform another read.
How are you supposed to handle this situation? I can imagine a couple of ugly ways, but no elegant one.