• Advertisement

Archived

This topic is now archived and is closed to further replies.

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

This topic is 6551 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement