public void ListenForClients() { this.serverSocket.Start(); while (true) { try { TcpClient clientSocket = this.serverSocket.AcceptTcpClient(); ClientArgs args = new ClientArgs(); args.ID = clientSocket; this.clientSocket.Add(clientSocket); OnNewClientRequest(this, args); Thread clientThread = new Thread(new ParameterizedThreadStart(ListenForMessage)); clientThread.Start(clientSocket); } catch (Exception e) { Console.WriteLine(e.StackTrace); break; } } }
public void ListenForClients() { this.serverSocket.Start(); while (true) { try { TcpClient clientSocket = this.serverSocket.AcceptTcpClient(); ClientArgs args = new ClientArgs(); args.ID = clientSocket; this.clientSocket.Add(clientSocket); OnNewClientRequest(this, args); Thread clientThread = new Thread(new ParameterizedThreadStart(ListenForMessage)); clientThread.Start(clientSocket); } catch(Exception e) { Console.WriteLine(e.StackTrace); break; } } }
private void newClientRequest(object a, ClientArgs e) { }
private void newClientRequest(object a, ClientArgs e) { logs.addLogFromOutside(Constants.NEW_CLIENT_LOG + " NetworkNode", true, Constants.LOG_INFO); }