fix for client port number (avoid socket bind problems if client on the same PC is started before the server)

This commit is contained in:
Volker Fischer 2020-05-07 20:22:14 +02:00
parent 07a92fb2c2
commit 84d53914b9

View file

@ -77,6 +77,13 @@ int main ( int argc, char** argv )
QString strWelcomeMessage = ""; QString strWelcomeMessage = "";
QString strClientName = APP_NAME; QString strClientName = APP_NAME;
// adjust default port number for client: use different default port than the server since
// if the client is started before the server, the server would get a socket bind error
if ( bIsClient )
{
iPortNumber += 10; // increment by 10
}
// QT docu: argv()[0] is the program name, argv()[1] is the first // QT docu: argv()[0] is the program name, argv()[1] is the first
// argument and argv()[argc()-1] is the last argument. // argument and argv()[argc()-1] is the last argument.
// Start with first argument, therefore "i = 1" // Start with first argument, therefore "i = 1"