Ejemplo n.º 1
0
        public void Connect()
        {
            // FIXME: sometimes it does not work correctly
            fLogger.WriteInfo("Public IP: " + NetHelper.GetPublicIPAddress());

            var snkInfoHash = ProtocolHelper.CreateSignInfoKey();

            fLogger.WriteInfo("Search for: " + snkInfoHash.ToHexString());

            fDHTClient.Run();
            fDHTClient.JoinNetwork();
            fDHTClient.SearchNodes(snkInfoHash);

            fTCPClient.Connect(fTCPListenerPort);

            fConnected = true;
            new Thread(() => {
                int x = 0;
                while (fConnected)
                {
                    if (++x >= 60)
                    {
                        CheckPeers();
                        x = 0;
                    }
                    Thread.Sleep(1000);
                }
            }).Start();
        }
Ejemplo n.º 2
0
        public void Connect()
        {
            fDHTClient.Run();
            fDHTClient.JoinNetwork();
            fDHTClient.SearchNodes(GKNInfoHash);

            fTCPClient.Connect(fTCPListenerPort);

            fConnected = true;
            new Thread(() => {
                int x = 0;
                while (fConnected)
                {
                    if (++x >= 60)
                    {
                        CheckPeers();
                        x = 0;
                    }
                    Thread.Sleep(1000);
                }
            }).Start();
        }