private async void button1_Click(object sender, RoutedEventArgs e) { Thread threadLable = new Thread(new ThreadStart(() => { while (true) { Dispatcher.Invoke(() => { List <P2PConnection> inNodes = P2PConnectionManager.GetInboundP2PConnections(); label.Content = "Inbound: " + inNodes.Count + " Outbound: " + P2PConnectionManager.GetOutboundP2PConnections().Count; if (inNodes.Count > 0) { } }); Thread.CurrentThread.Join(1000); } })); threadLable.IsBackground = true; threadLable.Start(); await P2PConnectionManager.ListenForIncomingP2PConnectionsAsync(IPAddress.Any, _networkParameters); }
public async void StarteMe() { P2PNetworkParameters netParams = new P2PNetworkParameters(P2PNetworkParameters.ProtocolVersion, false, 20966, (ulong)P2PNetworkParameters.NODE_NETWORK.FULL_NODE, (int)P2PNetworkParameters.RELAY.RELAY_ALWAYS); //start threaded loop listening for peers if (netParams.ListenForPeers) { await P2PConnectionManager.ListenForIncomingP2PConnectionsAsync(IPAddress.Any, netParams); } //start threaded loop maintaining max outbound connections to peers P2PConnectionManager.MaintainConnectionsOutbound(netParams); }