コード例 #1
0
        internal void ExchangeIpAdress(IPAddress adrr)
        {
            SMSG_NETWORKADRESSIP spkt = new SMSG_NETWORKADRESSIP();

            spkt.ConnectionFrom = adrr;
            spkt.SessionId      = 0;
            this.Send((byte[])spkt);
        }
コード例 #2
0
        internal void SetSessionId(uint session)
        {
            try
            {
                Trace.TraceInformation("Set session-id {1} received from: {0}", this.socket.RemoteEndPoint, session);
                if (session > 0)
                {
                    //Update session, add session to lookup table
                    this.session = session;
                    GatewayPool.Instance.lookup.Add(session, this);

                    //Exchange ip adress
                    LoginClient client;
                    if (NetworkManager.TryGetLoginClient(out client))
                    {
                        IPEndPoint           endpoint = (IPEndPoint)this.socket.RemoteEndPoint;
                        SMSG_NETWORKADRESSIP spkt     = new SMSG_NETWORKADRESSIP();
                        spkt.ConnectionFrom = endpoint.Address;
                        spkt.SessionId      = session;
                        client.Send((byte[])spkt);
                    }

                    //Forward to out client
                    SMSG_UKNOWN2 spkt2 = new SMSG_UKNOWN2();
                    spkt2.SessionId = this.session;
                    this.Send((byte[])spkt2);
                }
                else
                {
                    Trace.TraceError("Session with value 0 was given");
                }
            }
            catch (ObjectDisposedException)
            {
                //Closing connection
                this.Close();
            }
            catch (System.Net.Sockets.SocketException)
            {
                //Closing connection
                this.Close();
            }
        }