Beispiel #1
0
 protected virtual void ReceiveHandshake(PeerState peer)
 {
     if (Stopping)
     {
         return;
     }
     MessageIo.ReceiveHandshake(peer.Socket, peer, MessageReceived);
 }
Beispiel #2
0
 private static void EndAccept(IAsyncResult ar)
 {
     try
     {
         var socket    = (Socket)ar.AsyncState;
         var newsocket = (Socket)ar.AsyncState;
         //Socket newsocket = socket.EndAccept(ar);
         var peer = new PeerState(newsocket, (IPEndPoint)newsocket.RemoteEndPoint);
         MessageIo.ReceiveHandshake(newsocket, peer, HandshakeReceived);
         BeginListening();
     }
     catch (Exception e)
     {
         RaiseException(e);
     }
 }