ProcessPacket() public method

public ProcessPacket ( Byte data, int length ) : void
data Byte
length int
return void
Beispiel #1
0
        void ServerLoop()
        {
            var parser = new PacketParser(_messageHandler);
            var buffer = new byte[65536];

            while (!_disposed)
            {
                try {
                    int dataRead = _socket.Receive(buffer);
                    if (!_disposed && dataRead > 0)
                    {
                        parser.ProcessPacket(buffer, dataRead);
                    }
                }
                catch (SocketException) {
                    // It might exited by timeout. Nothing to do.
                }
                catch (ThreadAbortException) {
                    // Abort silently.
                }
                catch (Exception e) {
                    if (!_disposed)
                    {
                        UnityEngine.Debug.Log(e);
                    }
                    break;
                }
            }
        }
Beispiel #2
0
        void ServerLoop()
        {
            var parser = new PacketParser(_messageHandler);
            var buffer = new byte[65536];

            while (!_disposed)
            {
                try {
                    int dataRead = _socket.Receive(buffer);
                    if (!_disposed && dataRead > 0)
                        parser.ProcessPacket(buffer, dataRead);
                }
                catch (SocketException) {
                    // It might exited by timeout. Nothing to do.
                }
                catch (ThreadAbortException) {
                    // Abort silently.
                }
                catch (Exception e) {
                    if (!_disposed) UnityEngine.Debug.Log(e);
                    break;
                }
            }
        }