C# Class Protogame.MxReliability

The class that provides reliability and fragmentation infrastructure for Mx clients.

This class is used by MxDispatcher to interface with an MxClient in a reliable manner. When data is sent reliably, this class is used to fragment and reconstruct sets of data, ensuring that each fragment is either acknowledged by the receiving machine, or sent again.

Afficher le fichier Open project: RedpointGames/Protogame Class Usage Examples

Méthodes publiques

Méthode Description
MxReliability ( MxClient client ) : System

Initializes a new instance of the MxReliability class.

Send ( byte data ) : void

Sends data to the associated client reliably.

Update ( ) : void

Updates this reliability class, sending and receiving messages as required.

Méthodes protégées

Méthode Description
OnFragmentReceived ( Protogame.MxReliabilityTransmitEventArgs e ) : void

Raise the FragmentReceived event.

OnFragmentSent ( Protogame.MxReliabilityTransmitEventArgs e ) : void

Raise the OnFragmentSent event.

OnMessageAcknowledged ( Protogame.MxMessageEventArgs e ) : void

Raise the MessageAcknowledged event.

OnMessageReceived ( Protogame.MxMessageEventArgs e ) : void

Raise the MessageReceived event.

Private Methods

Méthode Description
CheckForFullAcknowledgement ( ) : void

Checks for and finishes any active messages that have now been completely acknowledged by the receiver.

ClientOnMessageAcknowledged ( object sender, Protogame.MxMessageEventArgs mxMessageEventArgs ) : void

Called when one of the fragments has been acknowledged by the remote client.

ClientOnMessageLost ( object sender, Protogame.MxMessageEventArgs mxMessageEventArgs ) : void

Called when one of the fragments has been detected as lost.

ClientOnMessageReceived ( object sender, Protogame.MxMessageReceiveEventArgs mxMessageEventArgs ) : void

Called when we have received a fragment from the underlying client.

UpdateReceive ( ) : void

Handles receiving fragments and firing the MessageReceived event when reconstruction is complete.

UpdateSend ( ) : void

Handles sending out fragments based on the messages in the queue.

UpdateSendActiveMessages ( ) : bool

Attempt to queue packets for the current active messages that need sending and returns whether it queued anything. If it didn't, then we return false and the caller (UpdateSend) can pick up another active message.

Method Details

MxReliability() public méthode

Initializes a new instance of the MxReliability class.
public MxReliability ( MxClient client ) : System
client MxClient /// The client that this reliability class is associated with. ///
Résultat System

OnFragmentReceived() protected méthode

Raise the FragmentReceived event.
protected OnFragmentReceived ( Protogame.MxReliabilityTransmitEventArgs e ) : void
e Protogame.MxReliabilityTransmitEventArgs /// The event arguments. ///
Résultat void

OnFragmentSent() protected méthode

Raise the OnFragmentSent event.
protected OnFragmentSent ( Protogame.MxReliabilityTransmitEventArgs e ) : void
e Protogame.MxReliabilityTransmitEventArgs /// The event arguments. ///
Résultat void

OnMessageAcknowledged() protected méthode

Raise the MessageAcknowledged event.
protected OnMessageAcknowledged ( Protogame.MxMessageEventArgs e ) : void
e Protogame.MxMessageEventArgs /// The event arguments. ///
Résultat void

OnMessageReceived() protected méthode

Raise the MessageReceived event.
protected OnMessageReceived ( Protogame.MxMessageEventArgs e ) : void
e Protogame.MxMessageEventArgs /// The event arguments. ///
Résultat void

Send() public méthode

Sends data to the associated client reliably.
public Send ( byte data ) : void
data byte /// The data to be sent. ///
Résultat void

Update() public méthode

Updates this reliability class, sending and receiving messages as required.
public Update ( ) : void
Résultat void