private void ConnectServer(int port) { try { server = new ServerObject(port); server.ServerMessage += PrintLog; listenThread = new Thread(new ThreadStart(server.Listen)); listenThread.Start(); //старт потока } catch (Exception ex) { server.Disconnect(); throw; } }