public override void Start() { TcpClient client = new TcpClient(); client.Connect(iporhost, port); connection = new DeveConnectionStreamSocket(client, this); connection.Start(); }
private void Runner() { tcpListener.Start(); while (!shouldShutdown) { if (!tcpListener.Pending()) { Thread.Sleep(100); } else { //blocks until a client has connected to the server TcpClient client = tcpListener.AcceptTcpClient(); Console.WriteLine("Client connected"); DeveConnectionStreamSocket deveClientConnection = new DeveConnectionStreamSocket(client, this); deveClientConnection.Start(); lock (clientConnections) { clientConnections.Add(deveClientConnection); } //Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientComm)); //clientThread.Start(client); } } foreach (DeveConnectionStreamSocket deveClientConnection in clientConnections) { deveClientConnection.Stop(); } tcpListener.Stop(); }