Class AckSystem
Inheritance
System.Object
Inherited Members
Show
Syntax
public class AckSystem : IDisposable
Constructors
AckSystem(IRawConnection, Config, Int32, ITime, Pool<ByteBuffer>, ILogger, Metrics)
Declaration
public AckSystem(IRawConnection connection, Config config, int maxPacketSize, ITime time, Pool<ByteBuffer> bufferPool, ILogger logger = null, Metrics metrics = null)
Parameters
Type | Name | Description |
---|
Mirage.SocketLayer.IRawConnection | connection | |
Mirage.SocketLayer.Config | config | |
System.Int32 | maxPacketSize | |
Mirage.SocketLayer.ITime | time | |
Mirage.SocketLayer.Pool<Mirage.SocketLayer.ByteBuffer> | bufferPool | |
ILogger | logger | |
Mirage.SocketLayer.Metrics | metrics | |
Fields
Declaration
public const int SEQUENCE_HEADER = 13
PacketType, sequence, ack sequence, mask
Declaration
public const int NOTIFY_HEADER_SIZE = 13
PacketType, sequence, ack sequence, mask, order
Declaration
public const int RELIABLE_HEADER_SIZE = 15
PacketType, ack sequence, mask
Declaration
public const int ACK_HEADER_SIZE = 11
FRAGMENT_INDEX_SIZE
Declaration
public const int FRAGMENT_INDEX_SIZE = 1
Smallest size a header for reliable packet, + 2 bytes per message
Declaration
public const int MIN_RELIABLE_HEADER_SIZE = 17
Smallest size a header for reliable packet, + 1 byte for fragment index
Declaration
public const int MIN_RELIABLE_FRAGMENT_HEADER_SIZE = 16
SizePerFragment
Declaration
public readonly int SizePerFragment
Methods
Dispose()
Declaration
NextReliablePacket(out AckSystem.ReliableReceived)
Gets next Reliable packet in order, packet consists for multiple messages
[length, message, length, message, ...]
Declaration
public bool NextReliablePacket(out AckSystem.ReliableReceived packet)
Parameters
Type | Name | Description |
---|
Mirage.SocketLayer.AckSystem.ReliableReceived | packet | |
Returns
Type | Description |
---|
System.Boolean | true if next packet is available |
GetNextFragment()
Declaration
public AckSystem.ReliableReceived GetNextFragment()
Returns
Type | Description |
---|
Mirage.SocketLayer.AckSystem.ReliableReceived | |
Update()
Declaration
SendNotify(Byte[], Int32, Int32)
Use for non-alloc version
Declaration
public INotifyToken SendNotify(byte[] inPacket, int inOffset, int inLength)
Parameters
Type | Name | Description |
---|
System.Byte[] | inPacket | |
System.Int32 | inOffset | |
System.Int32 | inLength | |
Returns
Type | Description |
---|
Mirage.SocketLayer.INotifyToken | |
SendNotify(Byte[], Int32, Int32, INotifyCallBack)
Declaration
public void SendNotify(byte[] inPacket, int inOffset, int inLength, INotifyCallBack callBacks)
Parameters
Type | Name | Description |
---|
System.Byte[] | inPacket | |
System.Int32 | inOffset | |
System.Int32 | inLength | |
Mirage.SocketLayer.INotifyCallBack | callBacks | |
SendReliable(Byte[], Int32, Int32)
Declaration
public void SendReliable(byte[] message, int offset, int length)
Parameters
Type | Name | Description |
---|
System.Byte[] | message | |
System.Int32 | offset | |
System.Int32 | length | |
ReceiveNotify(Byte[], Int32)
Receives incoming Notify packet
Ignores duplicate or late packets
Declaration
public ArraySegment<byte> ReceiveNotify(byte[] packet, int length)
Parameters
Type | Name | Description |
---|
System.Byte[] | packet | |
System.Int32 | length | |
Returns
Type | Description |
---|
System.ArraySegment<System.Byte> | default or new packet to handle |
InvalidFragment(Byte[])
Checks if fragment index is less than max fragment size
Declaration
public bool InvalidFragment(byte[] array)
Parameters
Type | Name | Description |
---|
System.Byte[] | array | |
Returns
Type | Description |
---|
System.Boolean | |
ReceiveReliable(Byte[], Int32, Boolean)
Declaration
public void ReceiveReliable(byte[] packet, int length, bool isFragment)
Parameters
Type | Name | Description |
---|
System.Byte[] | packet | |
System.Int32 | length | |
System.Boolean | isFragment | |
ReceiveAck(Byte[])
Declaration
public void ReceiveAck(byte[] packet)
Parameters
Type | Name | Description |
---|
System.Byte[] | packet | |