Fixed handling of return values

This commit is contained in:
Robert Osfield 2016-06-30 11:19:53 +01:00
parent 75183eb3dd
commit 4ed8558178

View File

@ -176,7 +176,10 @@ public:
{ {
assert( isConnected_ ); 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 ) 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_addr.s_addr = htonl( remoteEndpoint.address );
sendToAddr_.sin_port = htons( remoteEndpoint.port ); 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 ) void Bind( const IpEndpointName& localEndpoint )