Does CAsyncSocket::Receive return a NULL terminated buffer? <mt>

Started by
1 comment, last by DrJohnB 24 years, 1 month ago
Does CAsyncSocket::Receive -------------------------- virtual int Receive( void* lpBuf, int nBufLen, int nFlags = 0 ); return a NULL terminated buffer? I want to know the length of the buffer I just received.
Advertisement
I don''t believe that it''s null terminated, but the return value should be the number of bytes received. Unless the connection closed (it returns 0) or there was an error (it returns SOCKET_ERROR).
How did you know that''s what I wanted. Anyway I just noticed it had a non-void return type. However, that was after finished adding code to ::Send() to prefix my string with 3 chars representing the length of the rest of the string.

I knew ::Receive() had to know the length because you include it in the ::Send() call. You''re so fast with your help. Thank Si.

This topic is closed to new replies.

Advertisement