Skip to main content

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
TypeNameDescription
Mirage.SocketLayer.IRawConnectionconnection
Mirage.SocketLayer.Configconfig
System.Int32maxPacketSize
Mirage.SocketLayer.ITimetime
Mirage.SocketLayer.Pool<Mirage.SocketLayer.ByteBuffer>bufferPool
ILoggerlogger
Mirage.SocketLayer.Metricsmetrics

Fields

SEQUENCE_HEADER

Declaration
public const int SEQUENCE_HEADER = 13

NOTIFY_HEADER_SIZE

PacketType, sequence, ack sequence, mask

Declaration
public const int NOTIFY_HEADER_SIZE = 13

RELIABLE_HEADER_SIZE

PacketType, sequence, ack sequence, mask, order

Declaration
public const int RELIABLE_HEADER_SIZE = 15

ACK_HEADER_SIZE

PacketType, ack sequence, mask

Declaration
public const int ACK_HEADER_SIZE = 11

FRAGMENT_INDEX_SIZE

Declaration
public const int FRAGMENT_INDEX_SIZE = 1

MIN_RELIABLE_HEADER_SIZE

Smallest size a header for reliable packet, + 2 bytes per message

Declaration
public const int MIN_RELIABLE_HEADER_SIZE = 17

MIN_RELIABLE_FRAGMENT_HEADER_SIZE

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
public void Dispose()

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
TypeNameDescription
Mirage.SocketLayer.AckSystem.ReliableReceivedpacket
Returns
TypeDescription
System.Booleantrue if next packet is available

GetNextFragment()

Declaration
public AckSystem.ReliableReceived GetNextFragment()
Returns
TypeDescription
Mirage.SocketLayer.AckSystem.ReliableReceived

Update()

Declaration
public void Update()

SendNotify(Byte[], Int32, Int32)

Use for non-alloc version

Declaration
public INotifyToken SendNotify(byte[] inPacket, int inOffset, int inLength)
Parameters
TypeNameDescription
System.Byte[]inPacket
System.Int32inOffset
System.Int32inLength
Returns
TypeDescription
Mirage.SocketLayer.INotifyToken

SendNotify(Byte[], Int32, Int32, INotifyCallBack)

Declaration
public void SendNotify(byte[] inPacket, int inOffset, int inLength, INotifyCallBack callBacks)
Parameters
TypeNameDescription
System.Byte[]inPacket
System.Int32inOffset
System.Int32inLength
Mirage.SocketLayer.INotifyCallBackcallBacks

SendReliable(Byte[], Int32, Int32)

Declaration
public void SendReliable(byte[] message, int offset, int length)
Parameters
TypeNameDescription
System.Byte[]message
System.Int32offset
System.Int32length

ReceiveNotify(Byte[], Int32)

Receives incoming Notify packet Ignores duplicate or late packets

Declaration
public ArraySegment<byte> ReceiveNotify(byte[] packet, int length)
Parameters
TypeNameDescription
System.Byte[]packet
System.Int32length
Returns
TypeDescription
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
TypeNameDescription
System.Byte[]array
Returns
TypeDescription
System.Boolean

ReceiveReliable(Byte[], Int32, Boolean)

Declaration
public void ReceiveReliable(byte[] packet, int length, bool isFragment)
Parameters
TypeNameDescription
System.Byte[]packet
System.Int32length
System.BooleanisFragment

ReceiveAck(Byte[])

Declaration
public void ReceiveAck(byte[] packet)
Parameters
TypeNameDescription
System.Byte[]packet