public void Update() { if (null == mNetServer) { return; } NetIncomingMessage message; while (null != (message = mNetServer.ReadMessage())) { try { switch (message.MessageType) { case NetIncomingMessageType.DebugMessage: case NetIncomingMessageType.ErrorMessage: case NetIncomingMessageType.WarningMessage: case NetIncomingMessageType.VerboseDebugMessage: { HandleDebugMessage(message); break; } case NetIncomingMessageType.ConnectionApproval: { HandleConnectionApproval(message); break; } case NetIncomingMessageType.StatusChanged: { HandleStatusChanged(message); break; } case NetIncomingMessageType.Data: { HandleData(message); break; } default: { NetLog.WarnFormat( "{0} Unhandled message type:{1}, bytes:{2}", appIdentifier, message.MessageType, message.LengthBytes); break; } } } catch (Exception e) { NetLog.Exception(appIdentifier, e); } mNetServer.Recycle(message); } }
void HandleDebugMessage(NetIncomingMessage message) { switch (message.MessageType) { case NetIncomingMessageType.DebugMessage: { NetLog.DebugFormat("{0} {1}", appIdentifier, message.ReadString()); break; } case NetIncomingMessageType.ErrorMessage: { NetLog.ErrorFormat("{0}, {1}", appIdentifier, message.ReadString()); break; } case NetIncomingMessageType.WarningMessage: { NetLog.WarnFormat("{0}, {1}", appIdentifier, message.ReadString()); break; } case NetIncomingMessageType.VerboseDebugMessage: { NetLog.DebugFormat("{0}, {1}", appIdentifier, message.ReadString()); break; } } }
public void Update() { if (null == mNetClient) { return; } NetIncomingMessage message; while (null != (message = mNetClient.ReadMessage())) { try { switch (message.MessageType) { case NetIncomingMessageType.DebugMessage: case NetIncomingMessageType.ErrorMessage: case NetIncomingMessageType.WarningMessage: case NetIncomingMessageType.VerboseDebugMessage: { HandleDebugMessage(message); break; } case NetIncomingMessageType.StatusChanged: { HandleStatusChanged(message); break; } case NetIncomingMessageType.Data: { HandleData(message); break; } default: { NetLog.WarnFormat( "Unhandled message type:{0}, bytes:{1}", message.MessageType, message.LengthBytes); break; } } } catch (Exception e) { NetLog.Exception(e); } mNetClient.Recycle(message); } }