示例#1
0
 protected virtual void ReceiveHandshake(PeerState peer)
 {
     if (Stopping)
     {
         return;
     }
     MessageIO.ReceiveHandshake(peer.Socket, peer, MessageReceived);
 }
示例#2
0
 private static void EndAccept(IAsyncResult ar)
 {
     try
     {
         var    socket    = (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);
     }
 }