wsock32.dll的recv获取后,使用循环while读取单字节为\0时截取长度。
但是遇到了个问题:数据传输中需要”\0″,怎么样获取recv的真实长度?recv()返回值一直是1
但是遇到了个问题:数据传输中需要”\0″,怎么样获取recv的真实长度?recv()返回值一直是1
解决方案
40
recv返回值就是receive到的真实大小,你可以用buf[n]一次最多收n个字节
30
不知道有多少前人掉在TCP Socket
send(人多)send(病少)send(财富)
recv(人多病)recv(少财富)
陷阱里面啊!
http://bbs.csdn.net/topics/380167545
send(人多)send(病少)send(财富)
recv(人多病)recv(少财富)
陷阱里面啊!
http://bbs.csdn.net/topics/380167545
60
https://msdn.microsoft.com/en-us/library/ms740121(VS.85).aspx
If no error occurs, recv returns the number of bytes received and the buffer pointed to by the buf parameter will contain this data received. If the connection has been gracefully closed, the return value is zero.
If no error occurs, recv returns the number of bytes received and the buffer pointed to by the buf parameter will contain this data received. If the connection has been gracefully closed, the return value is zero.