Struct ReliableUtility
Syntax
public struct ReliableUtility
Fields
DefaultMinimumResendTime
Declaration
public const int DefaultMinimumResendTime = 64
Field Value
MaximumResendTime
Declaration
public const int MaximumResendTime = 200
Field Value
NullEntry
Declaration
public const int NullEntry = -1
Field Value
Methods
CalculateProcessingTime(NativeSlice<Byte>, UInt16, Int64)
Declaration
public static ushort CalculateProcessingTime(NativeSlice<byte> sharedBuffer, ushort sequenceId, long timestamp)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
sharedBuffer |
|
UInt16 |
sequenceId |
|
Int64 |
timestamp |
|
Returns
GetLocalPacketTimer(NativeSlice<Byte>, UInt16)
Declaration
public static ReliableUtility.PacketTimers*GetLocalPacketTimer(NativeSlice<byte> sharedBuffer, ushort sequenceId)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
sharedBuffer |
|
UInt16 |
sequenceId |
|
Returns
GetPacket(NativeSlice<Byte>, Int32)
Declaration
public static ReliableUtility.Packet*GetPacket(NativeSlice<byte> self, int sequence)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
|
Int32 |
sequence |
|
Returns
Declaration
public static ReliableUtility.PacketInformation*GetPacketInformation(NativeSlice<byte> self, int sequence)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
|
Int32 |
sequence |
|
Returns
GetRemotePacketTimer(NativeSlice<Byte>, UInt16)
Declaration
public static ReliableUtility.PacketTimers*GetRemotePacketTimer(NativeSlice<byte> sharedBuffer, ushort sequenceId)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
sharedBuffer |
|
UInt16 |
sequenceId |
|
Returns
InitializeContext(NativeSlice<Byte>, NativeSlice<Byte>, NativeSlice<Byte>, ReliableUtility.Parameters)
Declaration
public static ReliableUtility.SharedContext InitializeContext(NativeSlice<byte> sharedBuffer, NativeSlice<byte> sendBuffer, NativeSlice<byte> recvBuffer, ReliableUtility.Parameters param)
Parameters
Returns
InitializeProcessContext(NativeSlice<Byte>, ReliableUtility.Parameters)
Declaration
public static int InitializeProcessContext(NativeSlice<byte> self, ReliableUtility.Parameters param)
Parameters
Returns
ProcessCapacityNeeded(ReliableUtility.Parameters)
Declaration
public static int ProcessCapacityNeeded(ReliableUtility.Parameters param)
Parameters
Returns
Read header data and update reliability tracking information in the shared context.
- If the packets sequence ID is lower than the last received ID+1, then it's stale
- If the packets sequence ID is higher, then we'll process it and update tracking info in the shared context
Declaration
public static int Read(NetworkPipelineContext context, ReliableUtility.PacketHeader header)
Parameters
Returns
Type |
Description |
Int32 |
Sequence ID of the received packet.
|
Declaration
public static void ReadAckPacket(NetworkPipelineContext context, ReliableUtility.PacketHeader header)
Parameters
Release(NativeSlice<Byte>, Int32)
Declaration
public static void Release(NativeSlice<byte> self, int sequence)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
|
Int32 |
sequence |
|
Release(NativeSlice<Byte>, Int32, Int32)
Declaration
public static void Release(NativeSlice<byte> self, int start_sequence, int count)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
|
Int32 |
start_sequence |
|
Int32 |
count |
|
ReleaseOrResumePackets(NetworkPipelineContext)
Acknowledge the reception of packets which have been sent. The reliability
shared context/state is updated when packets are received from the other end
of the connection. The other side will update it's ackmask with which packets
have been received (starting from last received sequence ID) each time it sends
a packet back. This checks the resend timers on each non-acknowledged packet
and notifies if it's time to resend yet.
Declaration
public static bool ReleaseOrResumePackets(NetworkPipelineContext context)
Parameters
Type |
Name |
Description |
NetworkPipelineContext |
context |
Pipeline context, contains the buffer slices this pipeline connection owns.
|
Returns
ResumeReceive(NetworkPipelineContext, Int32, ref Boolean)
Resume or play back a packet we had received earlier out of order. When an out of order packet is received
it is stored since we need to first return the packet with the next sequence ID. When that packet finally
arrives it is returned but a pipeline resume is requested since we already have the next packet stored
and it can be processed immediately after.
Declaration
public static NativeSlice<byte> ResumeReceive(NetworkPipelineContext context, int startSequence, ref bool needsResume)
Parameters
Type |
Name |
Description |
NetworkPipelineContext |
context |
Pipeline context, we'll use both the shared reliability context and receive context.
|
Int32 |
startSequence |
The first packet which we need to retrieve now, there could be more after that.
|
Boolean |
needsResume |
Indicates if we need the pipeline to resume again.
|
Returns
Type |
Description |
NativeSlice<Byte> |
|
Resend a packet which we have not received an acknowledgement for in time. Pipeline resume
will be enabled if there are more packets which we need to resend. The send reliability context
will then also be updated to track the next packet we need to resume.
Declaration
public static NativeSlice<byte> ResumeSend(NetworkPipelineContext context, out ReliableUtility.PacketHeader header, ref bool needsResume)
Parameters
Type |
Name |
Description |
NetworkPipelineContext |
context |
Pipeline context, we'll use both the shared reliability context and send context.
|
ReliableUtility.PacketHeader |
header |
Packet header for the packet payload we're resending.
|
Boolean |
needsResume |
Indicates if a pipeline resume is needed again.
|
Returns
Type |
Description |
NativeSlice<Byte> |
Buffer slice to packet payload.
|
Exceptions
SetHeaderAndPacket(NativeSlice<Byte>, Int32, ReliableUtility.PacketHeader, InboundBufferVec, Int64)
Write packet, packet header and tracking information to the given buffer space. This buffer
should contain the reliability Context at the front, that contains the capacity of the buffer
and pointer offsets needed to find the slots we can copy the packet to.
Declaration
public static void SetHeaderAndPacket(NativeSlice<byte> self, int sequence, ReliableUtility.PacketHeader header, InboundBufferVec data, long timestamp)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
Buffer space where we can store packets.
|
Int32 |
sequence |
The sequence ID of the packet, this is used to find a slot inside the buffer.
|
ReliableUtility.PacketHeader |
header |
The packet header which we'll store with the packet payload.
|
InboundBufferVec |
data |
The packet data which we're storing.
|
Int64 |
timestamp |
|
Exceptions
SetMinimumResendTime(Int32, LocalNetworkDriver, NetworkPipeline, Int32, NetworkConnection)
Declaration
public static void SetMinimumResendTime(int value, LocalNetworkDriver driver, NetworkPipeline pipeline, int stageId, NetworkConnection con)
Parameters
SetMinimumResendTime(Int32, UdpNetworkDriver, NetworkPipeline, Int32, NetworkConnection)
Declaration
public static void SetMinimumResendTime(int value, UdpNetworkDriver driver, NetworkPipeline pipeline, int stageId, NetworkConnection con)
Parameters
SetPacket(NativeSlice<Byte>, Int32, NativeSlice<Byte>)
Declaration
public static void SetPacket(NativeSlice<byte> self, int sequence, NativeSlice<byte> data)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
|
Int32 |
sequence |
|
NativeSlice<Byte> |
data |
|
SetPacket(NativeSlice<Byte>, Int32, Void*, Int32)
Declaration
public static void SetPacket(NativeSlice<byte> self, int sequence, void *data, int length)
Parameters
SharedCapacityNeeded(ReliableUtility.Parameters)
Declaration
public static int SharedCapacityNeeded(ReliableUtility.Parameters param)
Parameters
Returns
ShouldSendAck(NetworkPipelineContext)
Declaration
public static bool ShouldSendAck(NetworkPipelineContext ctx)
Parameters
Returns
StoreReceiveTimestamp(NativeSlice<Byte>, UInt16, Int64, UInt16)
Declaration
public static void StoreReceiveTimestamp(NativeSlice<byte> sharedBuffer, ushort sequenceId, long timestamp, ushort processingTime)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
sharedBuffer |
|
UInt16 |
sequenceId |
|
Int64 |
timestamp |
|
UInt16 |
processingTime |
|
StoreRemoteReceiveTimestamp(NativeSlice<Byte>, UInt16, Int64)
Declaration
public static void StoreRemoteReceiveTimestamp(NativeSlice<byte> sharedBuffer, ushort sequenceId, long timestamp)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
sharedBuffer |
|
UInt16 |
sequenceId |
|
Int64 |
timestamp |
|
StoreTimestamp(NativeSlice<Byte>, UInt16, Int64)
Declaration
public static void StoreTimestamp(NativeSlice<byte> sharedBuffer, ushort sequenceId, long timestamp)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
sharedBuffer |
|
UInt16 |
sequenceId |
|
Int64 |
timestamp |
|
TryAquire(NativeSlice<Byte>, Int32)
Declaration
public static bool TryAquire(NativeSlice<byte> self, int sequence)
Parameters
Type |
Name |
Description |
NativeSlice<Byte> |
self |
|
Int32 |
sequence |
|
Returns
Store the packet for possible later resends, and fill in the header we'll use to send it (populate with
sequence ID, last acknowledged ID from remote with ackmask.
Declaration
public static int Write(NetworkPipelineContext context, InboundBufferVec inboundBuffer, ref ReliableUtility.PacketHeader header)
Parameters
Returns
Type |
Description |
Int32 |
Sequence ID assigned to this packet.
|
Write an ack packet, only the packet header is used and this doesn't advance the sequence ID.
The packet is not stored away for resend routine.
Declaration
public static void WriteAckPacket(NetworkPipelineContext context, ref ReliableUtility.PacketHeader header)
Parameters
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.