From 84d53914b9c3f81ecbaba6ef2ffab5f8b3380f76 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 7 May 2020 20:22:14 +0200 Subject: [PATCH] fix for client port number (avoid socket bind problems if client on the same PC is started before the server) --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index e06352ac..9867ccac 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -77,6 +77,13 @@ int main ( int argc, char** argv ) QString strWelcomeMessage = ""; 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 // argument and argv()[argc()-1] is the last argument. // Start with first argument, therefore "i = 1"