public ClObject(TcpClient tcpClient, ServObject serverObject) { Id = Guid.NewGuid().ToString(); client = tcpClient; server = serverObject; serverObject.AddConnection(this); }
static Thread listenThread; // stream for listening public static void ServerInitialize() { try { server = new ServObject(); listenThread = new Thread(new ThreadStart(server.Listen)); listenThread.Start(); } catch (Exception ex) { server.Disconnect(); Console.WriteLine(ex.Message); } }