diff --git a/LiteNetLib/NetManager.cs b/LiteNetLib/NetManager.cs index 737f616f..64e3a66c 100644 --- a/LiteNetLib/NetManager.cs +++ b/LiteNetLib/NetManager.cs @@ -1268,6 +1268,21 @@ public void SendToAll(ReadOnlySpan data, byte channelNumber, DeliveryMetho _peersLock.ExitReadLock(); } } + + /// + /// Send message without connection + /// + /// Raw data + /// Packet destination + /// Operation result + public bool SendUnconnectedMessage(ReadOnlySpan message, IPEndPoint remoteEndPoint) + { + int headerSize = NetPacket.GetHeaderSize(PacketProperty.UnconnectedMessage); + var packet = PoolGetPacket(message.Length + headerSize); + packet.Property = PacketProperty.UnconnectedMessage; + message.CopyTo(new Span(packet.RawData, headerSize, message.Length)); + return SendRawAndRecycle(packet, remoteEndPoint) > 0; + } #endif ///