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; } } }
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; } } }