Exemplo n.º 1
0
Arquivo: Dht.cs Projeto: Renha/Tox.NET
        private void HandlePingRequest(IPEndPoint endpoint, byte[] data)
        {
            Console.WriteLine("Received ping request from: {0}", endpoint);

            //we can't respond to a ping request of an unknown client
            var friend = GetNode(endpoint);
            if (friend == null)
                return;

            var request = new PingRequest(data, friend.SharedKey);

            //send a pong back immediately
            SendPingResponse(friend, request.PingID);
        }
Exemplo n.º 2
0
Arquivo: Dht.cs Projeto: Renha/Tox.NET
        private void SendPingRequest(DhtFriend friend)
        {
            var pingRequest = new PingRequest(KeyPair.PublicKey, CryptoRandom.NextUInt64());
            friend.AddPing(pingRequest.PingID);

            _net.SendPacket(friend, pingRequest);
        }