static async Task Main(string[] args) { var messageProtocol = new LengthProtocol(); DoSomethingWithEachClient sa = new DoSomethingWithEachClient(messageProtocol); ReadWriteServer server = new ReadWriteServer(sa); await server.StartAsync(); }
public ReadWriteServer(DoSomethingWithEachClient serverApplication) { _serverApplication = serverApplication; _listenSocket = new Socket(SocketType.Stream, ProtocolType.Tcp); _listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, 8087)); Console.WriteLine("Listening on port 8087"); _listenSocket.Listen(120); }