-
Notifications
You must be signed in to change notification settings - Fork 532
Expand file tree
/
Copy pathPooledPacket.cs
More file actions
32 lines (28 loc) · 1005 Bytes
/
PooledPacket.cs
File metadata and controls
32 lines (28 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace LiteNetLib
{
public readonly ref struct PooledPacket
{
internal readonly NetPacket _packet;
internal readonly byte _channelNumber;
/// <summary>
/// Maximum data size that you can put into such packet
/// </summary>
public readonly int MaxUserDataSize;
/// <summary>
/// Offset for user data when writing to Data array
/// </summary>
public readonly int UserDataOffset;
/// <summary>
/// Raw packet data. Do not modify header! Use UserDataOffset as start point for your data
/// </summary>
public byte[] Data => _packet.RawData;
internal PooledPacket(NetPacket packet, int maxDataSize, byte channelNumber)
{
_packet = packet;
UserDataOffset = _packet.HeaderSize;
_packet.Size = UserDataOffset;
MaxUserDataSize = maxDataSize - UserDataOffset;
_channelNumber = channelNumber;
}
}
}