Skip to main content

ServerMessageReceiverPerConnection

A class in Root.Township, Alta.Networking.

Server: per-connection receiver that holds incoming unreliable packets until the frame's processing step and handles connect and disconnect events. Made by ServerPacketReceiver.

Constructors​

MemberWhat it is
ServerMessageReceiverPerConnection(int connectionIdentifier, ISocket socket)Creates a ServerMessageReceiverPerConnection from connectionIdentifier and socket.

Fields​

9 private and internal fields
MemberWhat it is
private Connection connectionThe game Connection for this transport connection, once connected.
private int connectionIdentifierTransport connection id.
private bool isLoggingOnUnknownReceiveWhether the next unknown receive should still be logged.
private static Logger loggerLogger for connection events and receive errors.
private ISocket socketThe socket that creates the connection.
private ArraySegment<byte>[] unreliableBuffersRing buffer of unreliable packets waiting for this frame.
private int unreliableIndexNext write slot in the ring buffer.
private int unreliableLengthRing buffer size.
private int unreliableReceivedCountUnreliable packets received since the last ProcessUnreliable.

Methods​

MemberWhat it is
void HandleConnectionEvent(ITransportConnection transportConnection)Creates the Connection on first connect (or reuses it) and approves it.
void HandleDisconnectEvent()Disconnects the connection, or logs an error if none is known.
int ProcessUnreliable()Processes the buffered unreliable packets, oldest first, and returns how many arrived (including dropped ones).
void ReceiveUnreliable(ArraySegment<byte> data)Stores an unreliable packet in the ring buffer, overwriting the oldest when full.
3 private and internal methods
MemberWhat it is
private void InitializeBuffers()Makes the ring buffer, sized by NetworkingSettings.MaxUnreliableReceivedPerFrame.
private void LogUnknownReceive()Logs once when data arrives before a connect event.
private void ProcessMessage(ArraySegment<byte> message, bool isReliable)Passes a packet to the connection, logging fatal errors instead of throwing.

Used in​

Members of other types that take, return or hold a ServerMessageReceiverPerConnection: