D
Daniel T.
In this code:
unsigned char getByte( sd )
{
unsigned char result = 0;
int bytes = recv( sd, &result, 1, 0 );
if ( bytes < 0 )
throw runtime_error( "recv error" );
if ( bytes == 1 )
return result;
if ( bytes == 0 )
{
// what here?
}
}
(Assuming a blocking socket)
What does it mean when recv returns 0? Does it mean that the socket has
disconnected?
unsigned char getByte( sd )
{
unsigned char result = 0;
int bytes = recv( sd, &result, 1, 0 );
if ( bytes < 0 )
throw runtime_error( "recv error" );
if ( bytes == 1 )
return result;
if ( bytes == 0 )
{
// what here?
}
}
(Assuming a blocking socket)
What does it mean when recv returns 0? Does it mean that the socket has
disconnected?