UM_PER_CLIENT

This UDP mode is called ‘per client’.

The number for this UDP mode (to be used with mnStartServer and mnGetUDPMode) is 1. C++ users can use the constant UM_PER_CLIENT instead.

In this UDP mode, data is collected on a per client basis. This means that old packets for a client are discarded only when a new packet for that same client is received.

As well as this, out of order packets (old packets) cannot be received and are automatically discarded.

In UM_PER_CLIENT mode the operation parameter of mnRecvUDP is ignored but the client parameter is relevant on both the client and the server side.

There is a prefix of one unsigned integer added silently (you do not need to deal with it) to all outgoing UDP packets which is used to determine the age of a packet. The integer is the length of time in milliseconds that your application has been running for. You can use mnGetUDPClock to retrieve this integer.

The client can send packets normally without making any changes to the data it sends.

The server must add the following to the start of each packet it sends to a client:

Data Type Data Description
Integer Client ID of the client that this packet is about e.g. if the packet contains the 3D position of client 5, then this should be 5.

This integer is not received by the client and is removed by DarkNet; the remainder of the packet is received.

If the client receives a client ID that is too high or low to be valid then an error message will be displayed (on the client side).

If you want to send a packet that is not about any client, you can use a client ID of 0 which indicates that the packet is about the server.




This page is in the following sections:
(2) Unreliable (UDP)
(1) Networking
(0) DarkNet Help