protected virtual void ReceiveHandshake(PeerState peer) { if (Stopping) { return; } MessageIO.ReceiveHandshake(peer.Socket, peer, MessageReceived); }
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); } }