4.3 New Client Joins a Game Session with an Existing Client Example

The following example demonstrates the message sequence when a new client joins a DirectPlay game session that has an existing client.

Sequence diagram for a new client joining a game session with an existing client

Figure 3: Sequence diagram for a new client joining a game session with an existing client

Note In the diagram, different line styles are used to distinguish between message types, including query/response, TRANS_COMMAND, TRANS_USERDATA, and SESS_PATH_TEST.

The steps in the message sequence are as follows:

  1. A new client sends an EnumQuery message to search for a DirectPlay game session.

    Note EnumQuery messages are unreliable, and therefore, are at risk of being lost. In addition, it is possible to send multiple EnumQuery messages. In this example, it is assumed that the first EnumQuery message is lost and the second EnumQuery message is successfully received by the server.

  2. In response to the EnumQuery message, the server sends an EnumResponse message and echoes the EnumPayload field as part of the response.

  3. The connection handshake is started by the new client sending a TRANS_COMMAND_CONNECT packet to the server. The bMsgId field is reflected in the bRspId field of the TRANS_COMMAND_CONNECT_ACCEPT packet to correlate the response.

  4. The server responds by sending a TRANS_COMMAND_CONNECT_ACCEPT packet to the new client and echoes the bMsgID field of the TRANS_COMMAND_CONNECT packet in the bRspID field.

  5. The new client sends a TRANS_COMMAND_CONNECT_ACCEPT packet to acknowledge the connection. It echoes the bMsgId field of the TRANS_COMMAND_CONNECT_ACCEPT packet from the server in the bRspId field of the acknowledged packet.

  6. The new client and the server then exchange TRANS_USERDATA_KEEPALIVE packets to indicate the successful connection handshake.

  7. The new client sends its information to the server using the TRANS_USERDATA_PLAYER_CONNECT_INFO packet.

  8. The server sends the game session information to the new client using the TRANS_USERDATA_SEND_SESSION_INFO packet, and informs the existing client about the newly joining client using the TRANS_USERDATA_ADD_PLAYER packet.

  9. The new client tests the presence of a network path to the existing client by sending the SESS_PATH_TEST packet.

  10. The new client acknowledges the game session information sent by the server by sending the TRANS_USERDATA_ACK_SESSION_INFO packet.

  11. The server instructs the existing client to connect to the new client by sending the TRANS_USERDATA_INSTRUCT_CONNECT packet.

  12. The server also sends the TRANS_USERDATA_INSTRUCT_CONNECT packet to the new client to cause the new client to resynchronize its name table.

  13. The existing client validates the DPNID of the new client that was sent in the TRANS_USERDATA_INSTRUCT_CONNECT packet using the dpnid field sent in the TRANS_USERDATA_ADD_PLAYER packet. After successful validation of the DPNID, the existing client starts connecting to the new client by sending the TRANS_COMMAND CONNECT packet.

  14. The new client accepts the connection request from the existing client by sending the TRANS_COMMAND_CONNECT_ACCEPT packet.

  15. The existing client acknowledges the connection to the new client by sending the TRANS_COMMAND_CONNECT_ACCEPT packet.

  16. The new client and the existing client exchange the TRANS_USERDATA_KEEPALIVE packet to indicate successful connection handshake.

  17. The existing client sends its DPNID value in a TRANS_USERDATA_SEND_PLAYER_DNID packet to the new client.

  18. The new client and the existing client acknowledge the connection by exchanging TRANS_COMMAND_SACK packets between themselves and with the server.