Home > Software engineering >  The WinSock recv function
The WinSock recv function

Time:09-15

Recv the received data if there is a \ r \ n \ r \ n, the length of the return is \ r \ n \ r \ n the length of the data, before?????

CodePudding user response:

The recv the return value of the
The Return Value
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 then gracefully closed, the return value is zero.
Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.

CodePudding user response:

Is this your application layer protocol parsing rules of custom, and the recv function should has nothing to do ~

CodePudding user response:

Recv the return value is the recv successful receive the number of bytes at a time,

CodePudding user response:

Recv the return value is the recv successful receive the number of bytes at a time

CodePudding user response:

In binary!!!!!

CodePudding user response:

Buff size is 1024 oneself, full of buff, but return is not 1024 but to \ r \ n \ r \ n length

CodePudding user response:

Flow of communication, if a need to joining together, without reading and consider stick package, so it is best to get a simple protocol for start-stop qualifier, the string '\ 0' can be used to distinguish whether a single transmission



CodePudding user response:

If transfer is the file, and file \ 0

CodePudding user response:

\ r \ n takes a byte, each \ r \ n \ r \ n this is 4 bytes

CodePudding user response:

Try don't understand? Ask ten thousand times as oneself try again
  • Related