Skip to main content
GameDev.net gamedev.net
🔒 Locked

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

Started by DrJohnB Feb 17, 2000 at 11:13 AM 1 replies 1.2k views
Original Post
DrJohnB
DrJohnB
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.
SiCrane
SiCrane
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).
DrJohnB
DrJohnB
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.