public static void Recv_MSG_CHAT(TcpHandle client, ReadMsg read) { UInt16 type = read.ReadUInt16(); string info = read.ReadString(); if (callBack != null) callBack(info); }
public static void SendMsg_MSG_CHAT(TcpHandle client, string info) { WriteMsg msg = new WriteMsg((UInt16)MsgIds.MSG_CHAT); msg.WriteUInt16(1); msg.WriteString(info); client.Send(msg); }
protected virtual void Dispose(bool disposing) { if (!AlreadyDisposed) { /// 非托管资源,句柄,窗体组件... if (Sstream != null) { Sstream.Dispose(); } if (Nstream != null) { Nstream.Dispose(); } if (TcpHandle != null) { TcpHandle.Client.Dispose(); TcpHandle.Close(); } if (disposing) { /// 托管资源,new的堆内存 TcpHandle = null; } AlreadyDisposed = true; } }
public static void SendMsg_MSG_LOGIN(TcpHandle tcp) { WriteMsg msg = new WriteMsg((UInt16)MsgIds.MSG_LOGIN); msg.WriteString(tcp.gameState.Account); msg.WriteString(tcp.gameState.LoginKey); tcp.Send(msg); }
static void SetReceiveBufferSize(TcpHandle tcpHandle, int value) { try { _ = tcpHandle.ReceiveBufferSize(value); } catch (ObjectDisposedException ex) { ThrowHelper.ThrowChannelException(ex); } catch (OperationException ex) { ThrowHelper.ThrowChannelException(ex); } }
public static void Recv_MSG_LOGIN(TcpHandle tcp, ReadMsg read) { UInt16 ret = read.ReadUInt16(); if (1 != ret) { tcp.gameState.SetState(ELoginState.Login_ERR); Console.WriteLine("登陆失败(errno:" + ret + ")"); CountNum.AddErr(1); } else { tcp.gameState.SetState(ELoginState.Login_OK); CountNum.AddOK(1); } }
public static void Recv_MSG_Logout(TcpHandle tcp, ReadMsg read) { }