ServerPart server; // объект сервера public ClientPart(TcpClient tcpClient, ServerPart serverObject) { Id = Guid.NewGuid().ToString(); client = tcpClient; server = serverObject; serverObject.AddConnection(this); }
public void RunServer(int portHost) { try { server = new ServerPart(this, portHost); listenThread = new Thread(new ThreadStart(server.Listen)); listenThread.Start(); //старт потока } catch (Exception ex) { server.Disconnect(); Console.WriteLine(ex.Message); } }