|UNIX socket question
||[Feb. 27th, 2001|11:16 am]
I'm pretty new to UNIX socket programming, so bear with me.
This has been bothering me for a long time, and I can't seem to find an easy answer. Say I'm writing a LJ client in C, and I want to log in to LJ. So I make the connection, write the data to the write socket, and then close it. Then I receive data from the read socket, of course. But say I'm working with something like moodids and there's going to be a lot of data returned on the read socket (and not necessarily all in one burst), how do I know when to stop reading from the socket? I can't very well use recv and check if the size is less than 0, because LJ may not have transmitted everything in one send. Is there some way to check whether or not LJ has closed the write end of the socket (i.e. the read part of my socket)? Using poll or something?
Any help would be very much appreciated!