3.1 Connect Role Details

Role of a client when joining the client to the session

Figure 1: Role of a client when joining the client to the session

The role of a client when attempting to connect to the session:

  1. The client sends a DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO message (section 2.2.1.1) to the server and waits for the DN_SEND_CONNECT_INFO message (section 2.2.1.4) to be sent in response. If the server does not respond in time, the protocol times out and terminates the connection.

    Note When the client sends the DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO message, it includes the user-provided password described in section 5.2. When the server receives the message, it attempts to verify the password as described in Step 4 of section 3.1.5.1. If the server is able to verify the password, it sends a DN_SEND_CONNECT_INFO message to bring the new client into consistency with regard to the current application description state and player list. The DN_SEND_CONNECT_INFO message includes the current user password, which is essentially a redundant echo of the password that was verified by the server. However, if the server is unable to verify the password and validation fails, the server sends a DN_CONNECT_FAILED message (section 2.2.1.3) with the hResultCode field set to DPNERR_INVALIDPASSWORD or to another validation failure code.

  2. When the DN_SEND_CONNECT_INFO message is received from the server, the client processes the message. After the message is successfully processed, the client MUST send a DN_ACK_CONNECT_INFO message (section 2.2.1.8) to the server. If an error occurs during message processing, the client performs cleanup and ends the connection attempt.

Role of the server when joining the client to the session

Figure 2: Role of the server when joining the client to the session

The role of the server when responding to a request from a client to be joined to the game session:

  1. The server receives a DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO message from the client and begins message processing. If an error occurs during message processing, the message is ignored. Otherwise, the server responds to the client with a DN_SEND_CONNECT_INFO message that includes the connection data for the game session.

  2. The server waits for a DN_ACK_CONNECT_INFO message from the client. If the client does not send the acknowledgment (ACK) in time, the protocol times out and terminates the connection.

  3. When the DN_ACK_CONNECT_INFO message from the client is received by the server, the server processes the ACK. After the ACK is successfully processed, the connection is made and the client is joined to the game session. If an error occurs during message processing, the server performs cleanup and ends the connection attempt.

Role of a peer when adding the peer to the session

Figure 3: Role of a peer when adding the peer to the session

The role of a peer when attempting to be added to the game session:

  1. The nascent peer sends a DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO message to the host and waits for a response. If the host does not respond in time, the protocol times out and terminates the connection.

  2. When the DN_SEND_CONNECT_INFO message is received from the host, the nascent peer processes the message. The peer MUST maintain a copy of the name table information for each peer in the game session as specified in the DN_NAMETABLE_ENTRY_INFO field of the message. After the message is successfully processed, the nascent peer MUST send a DN_ACK_CONNECT_INFO message to the host. If an error occurs during message processing, the nascent peer performs cleanup and ends the connection attempt.

  3. After acknowledging the connection, the nascent peer waits to receive DN_SEND_PLAYER_DPNID messages (section 2.2.1.10) from all other connected, established peers in the game session. If all connected, established peers do not respond in time, the protocol times out and terminates the connection.

  4. When a DN_SEND_PLAYER_DPNID message is received from an established peer, the nascent peer processes the message. If an established peer is unable to connect to the nascent peer:

    • The established peer responds to the host with a DN_INSTRUCTED_CONNECT_FAILED message (section 2.2.1.11).

    • The connection attempt is canceled.

    • The host issues a DN_CONNECT_ATTEMPT_FAILED message (section 2.2.1.12) to the nascent peer.

      Otherwise, when DN_SEND_PLAYER_DPNID messages have been successfully received from all other connected, established peers, the nascent peer is connected and added to the game session.

Role of the host when adding a peer to the session

Figure 4: Role of the host when adding a peer to the session

The role of the host when responding to a request from a peer to be added to the game session:

The host receives a DN_INTERNAL_MESSAGE_PLAYER_CONNECT_INFO message from a nascent peer and begins message processing. If an error occurs during message processing, the message is ignored. Otherwise, the host responds to the nascent peer with a DN_SEND_CONNECT_INFO message that includes the connection data for the game session. At the same time, the host sends DN_ADD_PLAYER messages (section 2.2.1.7) to all connected, established peers in the game session.

  1. The peer processes the DN_SEND_CONNECT_INFO message. The peer SHOULD maintain a copy of the name table information for each peer in the game session as specified in the DN_NAMETABLE_ENTRY_INFO field of the message. The host waits for a DN_ACK_CONNECT_INFO message from the nascent peer. If the nascent peer does not respond in time, the protocol times out and terminates the connection.

  2. When the DN_ACK_CONNECT_INFO message from the nascent peer is received by the host, the host processes the ACK. If an error occurs during processing of the ACK, the host performs cleanup and ends the connection attempt. Otherwise, after the ACK is processed, the host sends a DN_INSTRUCT_CONNECT message (section 2.2.1.9) to all peers (including the nascent peer) instructing them to attempt a connection to the nascent peer. If an established peer is unable to connect to the nascent peer:

    • The established peer responds to the host with a DN_INSTRUCTED_CONNECT_FAILED message.

    • The connection attempt is canceled.

    • The host issues a DN_CONNECT_ATTEMPT_FAILED message to the nascent peer.

      Otherwise, it is assumed that the established peers are able to successfully connect to the nascent peer, and the nascent peer is added to the game session.

      When the nascent peer receives a DN_INSTRUCT_CONNECT message from the host, the message is used only to synchronize its name table with the established peers.