AddressFamily









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

Featured Snippets


File name: SocketUdp.cs Copy
119         internal void DnsAndConnect()
120         {
121             try
122             {
123                 lock (this.syncer)
124                 {
125                     this.sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
126
127                     IPAddress ep = IPhotonSocket.GetIpAddress(this.ServerAddress);
128                     this.sock.Connect(ep, this.ServerPort);
129
130                     this.State = PhotonSocketState.Connected;
131                 }
132             }
133             catch (SecurityException se)
134             {
135                 if (this.ReportDebugOfLevel(DebugLevel.ERROR))
136                 {
137                     this.Listener.DebugReturn(DebugLevel.ERROR, "Connect() failed: " + se.ToString());
138                 }
139
140                 this.HandleException(StatusCode.SecurityExceptionOnConnect);
141                 return;
142             }
143             catch (Exception se)
144             {
145                 if (this.ReportDebugOfLevel(DebugLevel.ERROR))
146                 {
147                     this.Listener.DebugReturn(DebugLevel.ERROR, "Connect() failed: " + se.ToString());
148                 }
149
150                 this.HandleException(StatusCode.ExceptionOnConnect);
151                 return;
152             }
153
154             Thread run = new Thread(new ThreadStart(ReceiveLoop));
155             run.Name = "photon receive thread";
156             run.IsBackground = true;
157             run.Start();
158         }

AddressFamily 123 lượt xem

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