PingId









How do I use Ping Id
Below are practical examples compiled from projects for learning and reference purposes

Featured Snippets


File name: PingCloudRegions.cs Copy
21     public override bool StartPing(string ip)
22     {
23         base.Init();
24
25         try
26         {
27             sock.ReceiveTimeout = 5000;
28             sock.Connect(ip, 5055);
29
30             PingBytes[PingBytes.Length - 1] = PingId;
31             sock.Send(PingBytes);
32             PingBytes[PingBytes.Length - 1] = (byte)(PingId - 1);
33         }
34         catch (Exception e)
35         {
36             sock = null;
37             Console.WriteLine(e);
38         }
39
40         return false;
41     }
File name: PingCloudRegions.cs Copy
43     public override bool Done()
44     {
45         if (this.GotResult || sock == null)
46         {
47             return true;
48         }
49
50         if (sock.Available <= 0)
51         {
52             return false;
53         }
54
55         int read = sock.Receive(PingBytes, SocketFlags.None);
56         //Debug.Log("Got: " + SupportClass.ByteArrayToString(PingBytes));
57         bool replyMatch = PingBytes[PingBytes.Length - 1] == PingId && read == PingLength;
58         if (!replyMatch) Debug.Log("ReplyMatch is false! ");
59
60
61         this.Successful = read == PingBytes.Length && PingBytes[PingBytes.Length - 1] == PingId;
62         this.GotResult = true;
63         return true;
64     }

PingId 101 lượt xem

Gõ tìm kiếm nhanh...