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; 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); } }