client port always +1 per definition, some files unix2dos
This commit is contained in:
parent
8e79f5b9ee
commit
682c2e5877
3 changed files with 903 additions and 901 deletions
|
@ -32,17 +32,19 @@ void CSocket::Init ( const quint16 iPortNumber )
|
||||||
// allocate memory for network receive and send buffer in samples
|
// allocate memory for network receive and send buffer in samples
|
||||||
vecbyRecBuf.Init ( MAX_SIZE_BYTES_NETW_BUF );
|
vecbyRecBuf.Init ( MAX_SIZE_BYTES_NETW_BUF );
|
||||||
|
|
||||||
// initialize the listening socket
|
// initialize the listening socket, per definition use the port number plus
|
||||||
bool bSuccess = SocketDevice.bind (
|
// one for the client to make it possible to run server and client on the
|
||||||
QHostAddress ( QHostAddress::Any ), iPortNumber );
|
// same computer
|
||||||
|
bool bSuccess;
|
||||||
// if no success, try if server is on same machine (only for client)
|
if ( bIsClient )
|
||||||
if ( ( !bSuccess ) && bIsClient )
|
|
||||||
{
|
{
|
||||||
// if server and client is on same machine, decrease port number by
|
|
||||||
// one by definition
|
|
||||||
bSuccess = SocketDevice.bind (
|
bSuccess = SocketDevice.bind (
|
||||||
QHostAddress( QHostAddress::Any ), iPortNumber - 1 );
|
QHostAddress( QHostAddress::Any ), iPortNumber + 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bSuccess = SocketDevice.bind (
|
||||||
|
QHostAddress ( QHostAddress::Any ), iPortNumber );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !bSuccess )
|
if ( !bSuccess )
|
||||||
|
|
Loading…
Reference in a new issue