public void Listen() { try { Listener.Start(); _containerInterfaces.Logger.LogInformation("Server Start listen"); while (true) { TcpClient client = Listener.AcceptTcpClient(); Thread thread = new Thread(() => { SeverHandler socketHandler = new SeverHandler(client, AllChatDetails, _containerInterfaces); socketHandler.Run(); }); thread.Start(); } } catch (Exception e) { Listener.Stop(); } }
public void Listen() { try { Listener.Start(); Console.WriteLine("Server Start listen"); while (true) { Thread thread = new Thread(() => { TcpClient client = Listener.AcceptTcpClient(); SeverHandler socketHandler = new SeverHandler(client, AllChatDetails); socketHandler.Run(); }); thread.Start(); } } catch (Exception e) { Listener.Stop(); } }