static void AcceptCallBack(IAsyncResult ar) { Socket serverSocket = ar.AsyncState as Socket; Socket clientSocket = serverSocket.EndAccept(ar); Console.WriteLine("connect sucess!"); Session session = new Session("Test"); session.socket = clientSocket; EndPoint endPoint = clientSocket.RemoteEndPoint; string[] clientInfo = (endPoint.ToString()).Split(":".ToArray()); session.ipAddress = IPAddress.Parse(clientInfo[0]); session.Port = int.Parse(clientInfo[1]); Packet_LoginResponse rsp = new Packet_LoginResponse(); rsp.Data.id = 123; session.Send <Packet_LoginResponse>(rsp); Console.WriteLine(string.Format("send to client: {0} !", rsp.Data.id)); }
public static void Process(Packet_LoginResponse packet) { LogHelper.PrintGreen($"--->>>LoginResponse ID£º{packet.Data.id}"); }
public static void Process(Packet_LoginResponse packet) { LogHelper.Print("+++++>>>>>C# process protocol!", LogColor.Green); LogHelper.Print("+++++>>>>>id:" + packet.Data.id, LogColor.Green); }
public static void Process(Packet_LoginResponse packet) { }
public static void Process(Packet_LoginResponse packet) { LogUtil.LogUtility.PrintError("=====>>>>>Recive from server!"); LogUtil.LogUtility.PrintError(string.Format("get id: {0} !", packet.Data.id)); }