SocketFlags









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

Featured Snippets


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     }
File name: SocketUdp.cs Copy
91         public override PhotonSocketError Send(byte[] data, int length)
92         {
93             lock (this.syncer)
94             {
95                 if (!this.sock.Connected)
96                 {
97                     return PhotonSocketError.Skipped;
98                 }
99
100                 try
101                 {
102                     sock.Send(data, 0, length, SocketFlags.None);
103                 }
104                 catch
105                 {
106                     return PhotonSocketError.Exception;
107                 }
108             }
109
110             return PhotonSocketError.Success;
111         }

SocketFlags 120 lượt xem

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