C# 클래스 Protogame.MxDispatcher

The Mx dispatcher; this handles receiving messages on the UDP client and dispatching them to the correct connected Mx client.
파일 보기 프로젝트 열기: RedpointGames/Protogame 1 사용 예제들

공개 메소드들

메소드 설명
Close ( ) : void

Closes the dispatcher permanently, terminating all inbound and outbound connections.

Connect ( IPEndPoint endpoint ) : MxClient

Explicitly connect to the specified endpoint, assuming there is an Mx dispatcher at the specified address.

This method is used to explicitly add clients, not to start the dispatcher. The dispatcher does not require an explicit start.

Disconnect ( MxClient client ) : void

Disconnects the specified Mx client. This removes it from the group that owns it, and prevents it from reconnecting to this dispatcher implicitly.

Disconnect ( MxClientGroup clientGroup ) : void

Disconnects the entire Mx client group, disconnecting all clients inside it.

GetBytesLastReceivedAndReset ( ) : int
GetBytesLastSentAndReset ( ) : int
MxDispatcher ( UdpClient client ) : System

Initializes a new instance of the MxDispatcher class.

MxDispatcher ( int port ) : System

Initializes a new instance of the MxDispatcher class.

PlaceInGroup ( MxClient client, string identifier ) : MxClientGroup

Places the specified Mx client in the specified group.

Send ( MxClient client, byte packet, bool reliable = false ) : void

Queue a packet for sending to the specified client.

Send ( MxClientGroup group, byte packet, bool reliable = false ) : void

Queue a packet for sending to the specified endpoint.

Update ( ) : void

Updates the dispatcher, receiving messages and connecting clients as appropriate.

this ( string identifier ) : MxClientGroup

Retrieves the client group for the given identifier.

보호된 메소드들

메소드 설명
OnClientConnected ( MxClient client ) : void

Raise the ClientConnected event.

OnClientDisconnectWarning ( Protogame.MxDisconnectEventArgs e ) : void

Raise the ClientDisconnectWarning event.

OnClientDisconnected ( MxClient client ) : void

Raise the ClientDisconnected event.

OnMessageAcknowledged ( Protogame.MxMessageEventArgs e ) : void

Raise the MessageAcknowledged event.

OnMessageLost ( Protogame.MxMessageEventArgs e ) : void

Raise the MessageLost event.

OnMessageReceived ( Protogame.MxMessageEventArgs e ) : void

Raise the MessageReceived event.

OnMessageSent ( Protogame.MxMessageEventArgs e ) : void

Raise the MessageSent event.

OnReliableReceivedProgress ( Protogame.MxReliabilityTransmitEventArgs e ) : void

Raise the ReliableReceivedProgress event.

OnReliableSendProgress ( Protogame.MxReliabilityTransmitEventArgs e ) : void

Raise the ReliableSendProgress event.

비공개 메소드들

메소드 설명
AssertNotClosed ( ) : void

Assert that the dispatcher has not been closed.

OnClientDisconnectWarning ( object sender, Protogame.MxDisconnectEventArgs e ) : void

Handle receiving a DisconnectWarning event from a client.

OnClientMessageAcknowledged ( object sender, Protogame.MxMessageEventArgs e ) : void

Handle receiving a MessageAcknowledged event from a client.

OnClientMessageLost ( object sender, Protogame.MxMessageEventArgs e ) : void

Handle receiving a MessageLost event from a client.

OnClientMessageReceived ( object sender, Protogame.MxMessageEventArgs e ) : void

Handle receiving a MessageReceived event from a client.

OnClientMessageSent ( object sender, Protogame.MxMessageEventArgs e ) : void

Handle receiving a MessageSent event from a client.

OnReliabilityFragmentReceived ( object sender, Protogame.MxReliabilityTransmitEventArgs e ) : void

Handle receiving a FragmentReceived event from a reliability class.

OnReliabilityFragmentSent ( object sender, Protogame.MxReliabilityTransmitEventArgs e ) : void

Handle receiving a FragmentSent event from a reliability class.

OnReliabilityMessageAcknowledged ( object sender, Protogame.MxMessageEventArgs e ) : void

Handle receiving a MessageAcknowledged event from a reliability class.

OnReliabilityMessageReceived ( object sender, Protogame.MxMessageEventArgs e ) : void

Handle receiving a MessageReceived event from a reliability class.

ReceiveNonBlocking ( UdpClient client, IPEndPoint &receive ) : byte[]

Receive a message in an non-blocking manner. If there is no message to receive, this function returns null.

RegisterForEvents ( MxClient client ) : void

Register for a client's events.

RegisterForEvents ( MxReliability reliability ) : void

Register for a reliability's events.

ThreadSafeGetOrCreateClient ( IPEndPoint endpoint ) : MxClient
UnregisterFromEvents ( MxClient client ) : void

Unregister from a client's events.

UnregisterFromEvents ( MxReliability reliability ) : void

Unregister from a reliability's events.

메소드 상세

Close() 공개 메소드

Closes the dispatcher permanently, terminating all inbound and outbound connections.
public Close ( ) : void
리턴 void

Connect() 공개 메소드

Explicitly connect to the specified endpoint, assuming there is an Mx dispatcher at the specified address.

This method is used to explicitly add clients, not to start the dispatcher. The dispatcher does not require an explicit start.

public Connect ( IPEndPoint endpoint ) : MxClient
endpoint System.Net.IPEndPoint /// The endpoint to connect to. ///
리턴 MxClient

Disconnect() 공개 메소드

Disconnects the specified Mx client. This removes it from the group that owns it, and prevents it from reconnecting to this dispatcher implicitly.
public Disconnect ( MxClient client ) : void
client MxClient The client.
리턴 void

Disconnect() 공개 메소드

Disconnects the entire Mx client group, disconnecting all clients inside it.
public Disconnect ( MxClientGroup clientGroup ) : void
clientGroup MxClientGroup The client group.
리턴 void

GetBytesLastReceivedAndReset() 공개 메소드

public GetBytesLastReceivedAndReset ( ) : int
리턴 int

GetBytesLastSentAndReset() 공개 메소드

public GetBytesLastSentAndReset ( ) : int
리턴 int

MxDispatcher() 공개 메소드

Initializes a new instance of the MxDispatcher class.
public MxDispatcher ( UdpClient client ) : System
client System.Net.Sockets.UdpClient
리턴 System

MxDispatcher() 공개 메소드

Initializes a new instance of the MxDispatcher class.
public MxDispatcher ( int port ) : System
port int /// The port of the UDP client. ///
리턴 System

OnClientConnected() 보호된 메소드

Raise the ClientConnected event.
protected OnClientConnected ( MxClient client ) : void
client MxClient /// The client. ///
리턴 void

OnClientDisconnectWarning() 보호된 메소드

Raise the ClientDisconnectWarning event.
protected OnClientDisconnectWarning ( Protogame.MxDisconnectEventArgs e ) : void
e Protogame.MxDisconnectEventArgs /// The event arguments. ///
리턴 void

OnClientDisconnected() 보호된 메소드

Raise the ClientDisconnected event.
protected OnClientDisconnected ( MxClient client ) : void
client MxClient /// The client. ///
리턴 void

OnMessageAcknowledged() 보호된 메소드

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

OnMessageLost() 보호된 메소드

Raise the MessageLost event.
protected OnMessageLost ( 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

OnMessageSent() 보호된 메소드

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

OnReliableReceivedProgress() 보호된 메소드

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

OnReliableSendProgress() 보호된 메소드

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

PlaceInGroup() 공개 메소드

Places the specified Mx client in the specified group.
public PlaceInGroup ( MxClient client, string identifier ) : MxClientGroup
client MxClient The Mx client.
identifier string The group identifier.
리턴 MxClientGroup

Send() 공개 메소드

Queue a packet for sending to the specified client.
public Send ( MxClient client, byte packet, bool reliable = false ) : void
client MxClient /// The client to send the message to. ///
packet byte /// The associated data to send. ///
reliable bool /// Whether or not this message should be sent reliably and intact. This also /// permits messages larger than 512 bytes to be sent. ///
리턴 void

Send() 공개 메소드

Queue a packet for sending to the specified endpoint.
public Send ( MxClientGroup group, byte packet, bool reliable = false ) : void
group MxClientGroup /// The group to send the message to. ///
packet byte /// The associated data to send. ///
reliable bool /// Whether or not this message should be sent reliably and intact. This also /// permits messages larger than 512 bytes to be sent. ///
리턴 void

Update() 공개 메소드

Updates the dispatcher, receiving messages and connecting clients as appropriate.
public Update ( ) : void
리턴 void

this() 공개 메소드

Retrieves the client group for the given identifier.
public this ( string identifier ) : MxClientGroup
identifier string The identifier for the group.
리턴 MxClientGroup