Hi, I am (still) working on converting some linux code to run on windows. My one remaining bit to sort involves putting everything received on the socket into a buffer and just getting a line out at a time to process, rather than getting several lines at once and then having to seperate them in order to process them seperately. I'm not sure if I've explained that clearly enough but I am hoping that anyone who know about this stuff will know what I'm on about.
In the linux code:
FILE* m_Rx = fdopen(clientSocket, "r");
setlinebuf( m_Rx );
Then after using select() to trigger when there is something received on the socket:
fgets( m_RxMsgBuf, RX_MSGBUF_LEN, m_Rx )
and then m_RxMsgBuf contains just one line from whatever is received on the socket so that just one line can be processed at a time.
Please could somebody help me find the simplest way to do this in windows. _fdopen() cannot be used with sockets, so I don't know how to link a socket with a stream. I also guess I would need to use setvbuf() instead of setlinebuf() in order to set the stream to line buffered mode.
Failing this, I will just try to write a method to call recv() on the socket without bothering with a stream, and then just grab a line from the socket's buffer at a time.
Many thanks for any help.