private void DataReceived(IAsyncResult iasyncResult_0)
 {
     if (!this.bool_0)
     {
         try
         {
             int num = 0;
             try
             {
                 num = base.EndReceive(iasyncResult_0);
             }
             catch
             {
                 this.method_1();
                 return;
             }
             if (num > 0)
             {
                 byte[] array = ByteUtility.ChompBytes(this.mDataBuffer, 0, num);
                 this.method_8(ref array);
                 this.WaitForData();
             }
             else
             {
                 this.method_1();
             }
         }
         catch
         {
             this.method_1();
         }
     }
 }
        private void OnReceive(IAsyncResult ar)
        {
            if (!this.bool_0)
            {
                try
                {
                    int num = 0;

                    try
                    {
                        num = base.EndReceive(ar);
                    }
                    catch
                    {
                        this.method_1();
                        return;
                    }

                    if (num < 0)
                    {
                        this.method_1();
                    }
                    else
                    {
                        byte[] array = ByteUtility.ChompBytes(this.Buffer, 0, num);
                        this.method_8(ref array);
                        this.BeginReceive();
                    }
                }
                catch
                {
                    this.method_1();
                }
            }
        }
Esempio n. 3
0
        private void DataReceived(IAsyncResult iAr)
        {
            // Connection not stopped yet?
            if (this.Alive == false)
            {
                return;
            }

            // Do an optional wait before processing the data
            if (RECEIVEDATA_MILLISECONDS_DELAY > 0)
            {
                Thread.Sleep(RECEIVEDATA_MILLISECONDS_DELAY);
            }

            // How many bytes has server received?
            int numReceivedBytes = 0;

            try
            {
                numReceivedBytes = mSocket.EndReceive(iAr);
            }
            catch (ObjectDisposedException)
            {
                ConnectionDead();
                return;
            }
            catch (Exception ex)
            {
                AleedaEnvironment.GetLog().WriteUnhandledExceptionError("IonTcpConnection.DataReceived", ex);

                ConnectionDead();
                return;
            }

            if (numReceivedBytes > 0)
            {
                // Copy received data buffer
                byte[] dataToProcess = ByteUtility.ChompBytes(mDataBuffer, 0, numReceivedBytes);

                // Decipher received data?
                if (mEncryptionStarted)
                {
                    dataToProcess = mRc4.Decipher(dataToProcess, numReceivedBytes);
                }

                // Route data to GameClient to parse and process messages
                RouteData(ref dataToProcess);
                //Environment.GetHabboHotel().GetClients().GetClient(this.ID).HandleConnectionData(ref dataToProcess);
            }

            // Wait for new data
            WaitForData();
        }
Esempio n. 4
0
        private void DataReceived(IAsyncResult iAr)
        {
            // Connection not stopped yet?
            if (this.Alive == false)
            {
                return;
            }

            // Do an optional wait before processing the data
            if (RECEIVEDATA_MILLISECONDS_DELAY > 0)
            {
                Thread.Sleep(RECEIVEDATA_MILLISECONDS_DELAY);
            }

            // How many bytes has server received?
            int numReceivedBytes = 0;

            try
            {
                numReceivedBytes = mSocket.EndReceive(iAr);
            }
            catch (ObjectDisposedException)
            {
                ConnectionDead();
                return;
            }
            catch (Exception ex)
            {
                Core.GetStandardOut().PrintError(ex.Message);

                ConnectionDead();
                return;
            }

            if (numReceivedBytes > 0)
            {
                // Copy received data buffer
                byte[] dataToProcess = ByteUtility.ChompBytes(mDataBuffer, 0, numReceivedBytes);

                // Route data to GameClient to parse and process messages
                RouteData(ref dataToProcess);

                HandleConnectionData(ref dataToProcess);
            }

            // Wait for new data
            WaitForData();
        }
Esempio n. 5
0
        private void DataReceived(IAsyncResult iAr)
        {
            // Connection not stopped yet?
            if (!IsAlive())
                return;

            // How many bytes has server received?
            int numReceivedBytes;
            try
            {
                numReceivedBytes = _socket.EndReceive(iAr);
            }
            catch (ObjectDisposedException)
            {
                Close();
                return;
            }
            catch (Exception ex)
            {
                CoreManager.ServerCore.GetStandardOut().PrintException(ex);

                Close();
                return;
            }

            if (numReceivedBytes > 0)
            {
                // Copy received data buffer
                byte[] dataToProcess = ByteUtility.ChompBytes(_dataBuffer, 0, numReceivedBytes);

                // Route data to GameClient to parse and process messages
                RouteData(ref dataToProcess);
            }

            // Wait for new data
            WaitForData();
        }