client port always +1 per definition, some files unix2dos

This commit is contained in:
Volker Fischer 2009-11-29 03:36:42 +00:00
parent 8e79f5b9ee
commit 682c2e5877
3 changed files with 903 additions and 901 deletions

View file

@ -32,17 +32,19 @@ void CSocket::Init ( const quint16 iPortNumber )
// allocate memory for network receive and send buffer in samples
vecbyRecBuf.Init ( MAX_SIZE_BYTES_NETW_BUF );
// initialize the listening socket
bool bSuccess = SocketDevice.bind (
QHostAddress ( QHostAddress::Any ), iPortNumber );
// if no success, try if server is on same machine (only for client)
if ( ( !bSuccess ) && bIsClient )
// initialize the listening socket, per definition use the port number plus
// one for the client to make it possible to run server and client on the
// same computer
bool bSuccess;
if ( bIsClient )
{
// if server and client is on same machine, decrease port number by
// one by definition
bSuccess = SocketDevice.bind (
QHostAddress( QHostAddress::Any ), iPortNumber - 1 );
QHostAddress( QHostAddress::Any ), iPortNumber + 1 );
}
else
{
bSuccess = SocketDevice.bind (
QHostAddress ( QHostAddress::Any ), iPortNumber );
}
if ( !bSuccess )