CSharpSocket
How do I use C Sharp Socket
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
32 | this.Listener.DebugReturn(DebugLevel.ALL, "CSharpSocket: UDP, Unity3d."); | 1 |
64 | this.EnqueueDebugReturn(DebugLevel.INFO, "CSharpSocket.Disconnect()"); | 2 |
File name: SocketUdp.cs
Copy
28 public SocketUdp(PeerBase npeer) : base(npeer)
29 {
30 if (this.ReportDebugOfLevel(DebugLevel.ALL))
31 {
32 this.Listener.DebugReturn(DebugLevel.ALL, "CSharpSocket: UDP, Unity3d.");
33 }
34
35 this.Protocol = ConnectionProtocol.Udp;
36 this.PollReceive = false;
37 }
File name: SocketUdp.cs
Copy
60 public override bool Disconnect()
61 {
62 if (this.ReportDebugOfLevel(DebugLevel.INFO))
63 {
64 this.EnqueueDebugReturn(DebugLevel.INFO, "CSharpSocket.Disconnect()");
65 }
66
67 this.State = PhotonSocketState.Disconnecting;
68
69 lock (this.syncer)
70 {
71 if (this.sock != null)
72 {
73 try
74 {
75 this.sock.Close();
76 }
77 catch (Exception ex)
78 {
79 this.EnqueueDebugReturn(DebugLevel.INFO, "Exception in Disconnect(): " + ex);
80 }
81
82 this.sock = null;
83 }
84 }
85
86 this.State = PhotonSocketState.Disconnected;
87 return true;
88 }
CSharpSocket 175 lượt xem
Gõ tìm kiếm nhanh...