Fixed handling of return values
This commit is contained in:
parent
75183eb3dd
commit
4ed8558178
@ -176,7 +176,10 @@ public:
|
||||
{
|
||||
assert( isConnected_ );
|
||||
|
||||
send( socket_, data, size, 0 );
|
||||
if (send( socket_, data, size, 0 ) < 0)
|
||||
{
|
||||
throw std::runtime_error("error when calling send(..)\n");
|
||||
}
|
||||
}
|
||||
|
||||
void SendTo( const IpEndpointName& remoteEndpoint, const char *data, int size )
|
||||
@ -184,7 +187,10 @@ public:
|
||||
sendToAddr_.sin_addr.s_addr = htonl( remoteEndpoint.address );
|
||||
sendToAddr_.sin_port = htons( remoteEndpoint.port );
|
||||
|
||||
sendto( socket_, data, size, 0, (sockaddr*)&sendToAddr_, sizeof(sendToAddr_) );
|
||||
if (sendto( socket_, data, size, 0, (sockaddr*)&sendToAddr_, sizeof(sendToAddr_) ) < 0)
|
||||
{
|
||||
throw std::runtime_error("error when calling send(..)\n");
|
||||
}
|
||||
}
|
||||
|
||||
void Bind( const IpEndpointName& localEndpoint )
|
||||
|
Loading…
Reference in New Issue
Block a user