Exemplo n.º 1
0
 public NHContext(NHServerConnection c, Stream i, AcceptMethod a, ILogger l)
 {
     connection     = c;
     inputStream    = i;
     acceptor       = a;
     logger         = l;
     sequenceNumber = -1;
     request        = new NHServerRequest(this, logger);
     response       = new NHServerResponse(inputStream, this, logger);
 }
Exemplo n.º 2
0
 async void HandleConnection(Socket connection, AcceptMethod acceptor)
 {
     try
     {
         using (NetworkStream stream = new NetworkStream(connection, true))
         {
             NHServerConnection connectionHandler =
                 new NHServerConnection(stream, connection.RemoteEndPoint, serverAddress, acceptor, logger);
             await connectionHandler.Run();
         }
     }
     catch (Exception e)
     {
         logger.Log("Got exception " + e.ToString());
         // the connection went away
     }
 }