MxDispatcher

class MxDispatcher : System.Object

The Mx dispatcher; this handles receiving messages on the UDP client and dispatching them to the correct connected Mx client.

readonly bool Closed

Gets a value indicating whether this dispatcher has been closed.

Value:Whether or not this dispatcher has been closed.
readonly Protogame.MxClientGroup Item
readonly System.Collections.Generic.IEnumerable<KeyValuePair`2> Latencies

Gets an enumeration of the latencies for all connected endpoints.

Value:An enumeration of the latencies for all connected endpoints.
readonly System.Collections.Generic.IEnumerable<MxClientGroup> AllClientGroups
readonly System.Collections.Generic.IEnumerable<MxClientGroup> ValidClientGroups
public void add_ClientConnected(MxClientEventHandler value)
Parameters:
  • value (Protogame.MxClientEventHandler) –
public void remove_ClientConnected(MxClientEventHandler value)
Parameters:
  • value (Protogame.MxClientEventHandler) –
public void add_ClientDisconnectWarning(MxDisconnectEventHandler value)
Parameters:
  • value (Protogame.MxDisconnectEventHandler) –
public void remove_ClientDisconnectWarning(MxDisconnectEventHandler value)
Parameters:
  • value (Protogame.MxDisconnectEventHandler) –
public void add_ClientDisconnected(MxClientEventHandler value)
Parameters:
  • value (Protogame.MxClientEventHandler) –
public void remove_ClientDisconnected(MxClientEventHandler value)
Parameters:
  • value (Protogame.MxClientEventHandler) –
public void add_MessageAcknowledged(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void remove_MessageAcknowledged(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void add_MessageLost(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void remove_MessageLost(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void add_MessageReceived(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void remove_MessageReceived(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void add_MessageSent(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void remove_MessageSent(MxMessageEventHandler value)
Parameters:
  • value (Protogame.MxMessageEventHandler) –
public void add_ReliableReceivedProgress(MxReliabilityTransmitEventHandler value)
Parameters:
  • value (Protogame.MxReliabilityTransmitEventHandler) –
public void remove_ReliableReceivedProgress(MxReliabilityTransmitEventHandler value)
Parameters:
  • value (Protogame.MxReliabilityTransmitEventHandler) –
public void add_ReliableSendProgress(MxReliabilityTransmitEventHandler value)
Parameters:
  • value (Protogame.MxReliabilityTransmitEventHandler) –
public void remove_ReliableSendProgress(MxReliabilityTransmitEventHandler value)
Parameters:
  • value (Protogame.MxReliabilityTransmitEventHandler) –
public void Close()

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

public Protogame.MxClientGroup PlaceInGroup(MxClient client, string identifier)

Places the specified Mx client in the specified group.

Parameters:
  • client (Protogame.MxClient) – The Mx client.
  • identifier (string) – The group identifier.
public MxClient Connect(System.Net.IPEndPoint endpoint)

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.

Parameters:
  • endpoint (System.Net.IPEndPoint) – The endpoint to connect to.
public void Disconnect(Protogame.MxClientGroup clientGroup)

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

Parameters:
  • clientGroup (Protogame.MxClientGroup) – The client group.
public void Disconnect(MxClient client)

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

Parameters:
  • client (Protogame.MxClient) – The client.
public int GetBytesLastReceivedAndReset()
public int GetBytesLastSentAndReset()
public void Send(Protogame.MxClientGroup group, System.Byte[] packet, bool reliable)

Queue a packet for sending to the specified endpoint.

Parameters:
  • group (Protogame.MxClientGroup) – The group to send the message to.
  • packet (System.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.
public void Send(MxClient client, System.Byte[] packet, bool reliable)

Queue a packet for sending to the specified client.

Parameters:
  • client (Protogame.MxClient) – The client to send the message to.
  • packet (System.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.
public void Update()

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