C# 클래스 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.

파일 보기 프로젝트 열기: RedpointGames/Protogame 1 사용 예제들

공개 메소드들

메소드 설명
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.

보호된 메소드들

메소드 설명
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.

비공개 메소드들

메소드 설명
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.

메소드 상세

MxReliability() 공개 메소드

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

OnFragmentReceived() 보호된 메소드

Raise the FragmentReceived event.
protected OnFragmentReceived ( Protogame.MxReliabilityTransmitEventArgs e ) : void
e Protogame.MxReliabilityTransmitEventArgs /// The event arguments. ///
리턴 void

OnFragmentSent() 보호된 메소드

Raise the OnFragmentSent event.
protected OnFragmentSent ( Protogame.MxReliabilityTransmitEventArgs e ) : void
e Protogame.MxReliabilityTransmitEventArgs /// The event arguments. ///
리턴 void

OnMessageAcknowledged() 보호된 메소드

Raise the MessageAcknowledged event.
protected OnMessageAcknowledged ( Protogame.MxMessageEventArgs e ) : void
e Protogame.MxMessageEventArgs /// The event arguments. ///
리턴 void

OnMessageReceived() 보호된 메소드

Raise the MessageReceived event.
protected OnMessageReceived ( Protogame.MxMessageEventArgs e ) : void
e Protogame.MxMessageEventArgs /// The event arguments. ///
리턴 void

Send() 공개 메소드

Sends data to the associated client reliably.
public Send ( byte data ) : void
data byte /// The data to be sent. ///
리턴 void

Update() 공개 메소드

Updates this reliability class, sending and receiving messages as required.
public Update ( ) : void
리턴 void