static private ReadProtocol ( byte buffer, int length, byte &firstParam, byte &secondParam ) : bool | ||
buffer | byte | |
length | int | |
firstParam | byte | |
secondParam | byte | |
리턴 | bool |
private void HandlePing( NetPeer peer, byte[] buffer, int length) { if (peer.IsConnected == false) { return; } bool success = NetEncoding.ReadProtocol( buffer, length, out byte pingSeq, out byte loss); // Validate if (success == false) { NetDebug.LogError("Error reading ping"); return; } peer.OnReceivePing(Time, loss); sender.SendPong(peer, pingSeq, peer.GenerateDrop()); }
private void HandlePong( NetPeer peer, byte[] buffer, int length) { if (peer.IsConnected == false) { return; } bool success = NetEncoding.ReadProtocol( buffer, length, out byte pongSeq, out byte drop); // Validate if (success == false) { NetDebug.LogError("Error reading pong"); return; } peer.OnReceivePong(Time, pongSeq, drop); }
private void HandleKick( NetPeer peer, byte[] buffer, int length) { if (peer.IsClosed) { return; } byte rawReason; byte userReason; bool success = NetEncoding.ReadProtocol( buffer, length, out rawReason, out userReason); // Validate if (success == false) { NetDebug.LogError("Error reading kick"); return; } NetCloseReason closeReason = (NetCloseReason)rawReason; // Skip the packet if it's a bad reason (this will cause error output) if (NetUtil.ValidateKickReason(closeReason) == NetCloseReason.INVALID) { return; } peer.OnReceiveOther(this.Time); this.ClosePeerSilent(peer); this.eventOut.Enqueue( this.CreateClosedEvent(peer, closeReason, userReason)); }