bool TrySendMTU(int size) { NetOutboundPacket msg = new NetOutboundPacket(NetDeliveryMethod.Unreliable); msg.Type = NetPacketType.MTUTest; msg.SendImmediately = true; msg.WriteBytes(new byte[size]); // Have to set the header manually since this isn't technically a legit packet msg.SetId(messenger.AllocatePacketId()); msg.PrependHeader(); return(messenger.SendDataToSocket(msg.data, EndPoint, true)); }
internal void SendInternalPacket(NetOutboundPacket packet, IPEndPoint to) { packet.RemovePadding(); packet.SetId(AllocatePacketId()); if (packet.Type == NetPacketType.ConnectionRequest) { NetEncryption.EncryptPacket(packet); } packet.PrependHeader(); if (NetLogger.LogPacketSends && !IsPingPacket(packet.Type)) { NetLogger.LogVerbose("[Outbound:{0}] {1}", to, packet.ToInternalString()); } SendDataToSocket(packet.data, to, false); }
void WriteOutboundPacketHeader(NetOutboundPacket packet) { // Allocate the packet's Id and prepend its header packet.SetId(messenger.AllocatePacketId()); packet.PrependHeader(); }