diff --git a/client/CServerHandler.cpp b/client/CServerHandler.cpp index e0193efdc..dd3d0ebbc 100644 --- a/client/CServerHandler.cpp +++ b/client/CServerHandler.cpp @@ -161,6 +161,18 @@ void CServerHandler::startLocalServerAndConnect() threadRunLocalServer->join(); th->update(); + + try + { + CConnection testConnection(settings["server"]["server"].String(), getDefaultPort(), NAME, uuid); + logNetwork->error("Port is busy, kill other vcmiserver processes"); + return; + } + catch(...) + { + //no connection means that port is not busy and we can start local server + } + #ifdef VCMI_ANDROID { CAndroidVMHelper envHelper;