public void SendNatNegCookieToGameServer(string data) { LogWriter.LogCurrentClass(this); NatNegCookie cookie = JsonConvert.DeserializeObject <NatNegCookie>(data); IPAddress address = IPAddress.Parse(cookie.GameServerRemoteIP); int port = int.Parse(cookie.GameServerRemotePort); IPEndPoint ipEnd = new IPEndPoint(address, port); EndPoint endPoint = ipEnd; QRSession session; if (!QRSessionManager.Sessions.TryGetValue(endPoint, out session)) { LogWriter.ToLog(LogEventLevel.Error, "Can not find game server in QR"); return; } byte[] clientMessage = new ClientMessageResponse( cookie.NatNegMessage, MessageKey++, session.InstantKey).BuildResponse(); session.SendAsync(clientMessage); }
protected override void ResponseConstruct() { _response = new ClientMessageResponse(_request); }