private static IEnumerable MainLoop() { Console.WriteLine("server start..."); var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Bind(new IPEndPoint(IPAddress.Any, 8077)); socket.Listen(5); while (true) { yield return(WaitFor.Accept(socket).With(out var client)); Console.WriteLine($"connect client {client.R.RemoteEndPoint}"); Container.StartCoroutine(ProcessClient(client)).Catch(e => { Console.Error.WriteLine(e); client.R.Close(); }); } }