small merge fixes

This commit is contained in:
Volker Fischer 2020-04-20 16:57:00 +02:00
parent e305eac01c
commit ee014bbd83

View File

@ -54,9 +54,9 @@ void CSocket::Init ( const quint16 iPortNumber )
if ( bIsClient ) if ( bIsClient )
{ {
if (iPortNumber == 0) if ( iPortNumber == 0 )
{ {
// If port number is 0, bind the client to a random available port. // if port number is 0, bind the client to a random available port
UdpSocketInAddr.sin_port = htons ( 0 ); UdpSocketInAddr.sin_port = htons ( 0 );
bSuccess = ( ::bind ( UdpSocket , bSuccess = ( ::bind ( UdpSocket ,
@ -68,12 +68,11 @@ void CSocket::Init ( const quint16 iPortNumber )
// Per definition use the port number plus ten for the client to make // Per definition use the port number plus ten for the client to make
// it possible to run server and client on the same computer. If the // it possible to run server and client on the same computer. If the
// port is not available, try "NUM_SOCKET_PORTS_TO_TRY" times with // port is not available, try "NUM_SOCKET_PORTS_TO_TRY" times with
// incremented port numbers // incremented port numbers.
quint16 iClientPortIncrement = 10; // start value: port nubmer plus ten quint16 iClientPortIncrement = 10; // start value: port nubmer plus ten
bSuccess = false; // initialization for while loop bSuccess = false; // initialization for while loop
while ( !bSuccess && while ( !bSuccess && ( iClientPortIncrement <= NUM_SOCKET_PORTS_TO_TRY ) )
( iClientPortIncrement <= NUM_SOCKET_PORTS_TO_TRY ) )
{ {
UdpSocketInAddr.sin_port = htons ( iPortNumber + iClientPortIncrement ); UdpSocketInAddr.sin_port = htons ( iPortNumber + iClientPortIncrement );