//private Queue<MsgBuffer> msgBuffers = new Queue<MsgBuffer>(); //自己创建连接的概念 同一个Server IP Port public UDPAgent(IPEndPoint endPoint, SocketServer ss, UdpClient client) { //udpClient = client; remoteEnd = endPoint; socketServer = ss; msgReader = new ServerMsgReader(); msgReader.msgHandle = HandleMsg; udpClient = client; LogHelper.Log("UDP", "AddUDPAgent: " + endPoint); }
public Agent(Socket socket) { socket.NoDelay = true; id = ++maxId; mSocket = socket; ep = mSocket.RemoteEndPoint; msgReader = new ServerMsgReader(); msgReader.msgHandle = handleMsg; //设置ServerMsgReader解析二进制数据后的处理函数 Debug.Log("AgentCreate " + id); var ip = socket.RemoteEndPoint as IPEndPoint; LogHelper.LogClientLogin(string.Format("ip={0}", ip.Address)); }