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; } } }
void HandleConnectionApproval(NetIncomingMessage message) { NetConnection conn = message.SenderConnection; mConfig.onIncommingConnection(conn); conn.Approve(); NetLog.DebugFormat("{0} Approve connection {1}", appIdentifier, conn.RemoteEndPoint); }
void HandleStatusChanged(NetIncomingMessage message) { // <?> 接收到这个消息的时候, mClient.connectionStatus是否和status一致 NetConnectionStatus status = (NetConnectionStatus)message.ReadByte(); string reason = message.ReadString(); if (null != onNetStatusChanged) { onNetStatusChanged(this, status, reason); } NetLog.DebugFormat( "connection({0}) status changed: {1}:{2}", message.SenderEndPoint, status, reason); }
void HandleStatusChanged(NetIncomingMessage message) { NetConnectionStatus status = (NetConnectionStatus)message.ReadByte(); string reason = message.ReadString(); if (null != mConfig.onConnectionStatusChanged) { mConfig.onConnectionStatusChanged(message.SenderConnection, reason); } NetLog.DebugFormat( "{0} Connection {1} status changed: {2}:{3}", appIdentifier, message.SenderEndPoint, status, reason); }