Esempio n. 1
1
        public override void InputThread()
        {
            try
            {
                using (Socket mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                {
                    mainSocket.Bind(new IPEndPoint(IPAddress.Any, this.Port));
                    mainSocket.Listen(10);
                    logger.Info("TCP listening on port: {0}", this.Port);

                    byte[] buffer = new byte[65536];

                    while (!InputThreadQuitRequested())
                    {
                        if (mainSocket.Poll(1000000, SelectMode.SelectRead))
                        {
                            Socket childSocket = mainSocket.Accept();
                            TCPConnection conn = new TCPConnection(this, childSocket);
                            logger.Info("{0} accepted.", conn);
                            conn.Start();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                RaiseError(ex);
            }
            finally
            {
            }
        }
Esempio n. 2
0
        public override void InputThread()
        {
            try
            {
                using (Socket mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
                {
                    mainSocket.Bind(new IPEndPoint(IPAddress.Any, this.Port));
                    mainSocket.Listen(10);
                    logger.Info("TCP listening on port: {0}", this.Port);

                    byte[] buffer = new byte[65536];

                    while (!InputThreadQuitRequested())
                    {
                        if (mainSocket.Poll(1000000, SelectMode.SelectRead))
                        {
                            Socket        childSocket = mainSocket.Accept();
                            TCPConnection conn        = new TCPConnection(this, childSocket);
                            logger.Info("{0} accepted.", conn);
                            conn.Start();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                RaiseError(ex);
            }
            finally
            {
            }
        }
Esempio n. 3
0
 public XClientGameEmulator(Config.ConfigNet conf, TCPManager man, XChat.XClientEmulator pBase, string pAccount, PacketOut pOut)
 {
     m_szAccount       = pAccount;
     m_cGameConnection = new TCPConnection(man, null, this, conf);
     try {
         m_cGameConnection.Start();
         m_cGameConnection.SendTCP(CreateVersionPacket());
         m_cGameConnection.SendTCP(pOut);
     }
     catch {
         XLog.Log("Can't connect to Game Server!");
     }
 }
Esempio n. 4
0
        public XClientAuthEmulator(TCPManager man, Config.ConfigNet conf, string pAccount, string pPassword, XChat.XClientEmulator cBase)
        {
            m_szName      = pAccount;
            m_szPassword  = pPassword;
            m_cClientBase = cBase;

            try {
                m_cAuthConnection = new TCPConnection(man, null, this, conf);
                m_cAuthConnection.Start();
                m_cAuthConnection.SendTCP(this.CreateVersionPacket());
                m_cAuthConnection.SendTCP(this.CreateAESPacket());
            }
            catch {
                XLog.Log("Can't connect to Authentication Server!");
            }
        }