private void OnNewConnection(P2PServerNode node) { if (NewConnection != null) { NewConnection(node); } }
private void acceptCallback(IAsyncResult ar) { var listener = (Socket)ar.AsyncState; var socket = listener.EndAccept(ar); // create server node var server = new P2PServerNode(socket); OnNewConnection(server); listener.BeginAccept(new AsyncCallback(acceptCallback), listener); }