Microsoft DirectX 8.1 (C++)

DPN_MSGID_INDICATE_CONNECT

Microsoft® DirectPlay® generates the DPN_MSGID_INDICATE_CONNECT message when a player attempts to connect to a peer-to-peer or client/server session.

DPNMSG_INDICATE_CONNECT

The DPNMSG_INDICATE_CONNECT structure contains information for the DPN_MSGID_INDICATE_CONNECT system message.

This structure gives the opportunity for the host application to allow or reject the connection based on user data and provide reply information to the connecting application.

typedef struct {
    DWORD     dwSize;
    PVOID     pvUserConnectData;
    DWORD     dwUserConnectDataSize;
    PVOID     pvReplyData; 
    DWORD     dwReplyDataSize;
    PVOID     pvReplyContext;
    PVOID     pvPlayerContext;
    IDirectPlay8Address*  pAddressPlayer;
    IDirectPlay8Address*  pAddressDevice;
} DPNMSG_INDICATE_CONNECT, *PDPNMSG_INDICATE_CONNECT;
dwSize
Size of this structure.
pvUserConnectData
Data of the connecting player.
dwUserConnectDataSize
Size of the data, in bytes, contained in the pvUserConnectData member.
pvReplyData
Connection reply data. This data must be valid beyond the scope of the callback message handler. You will receive a DPN_MSGID_RETURN_BUFFER message when Microsoft® DirectPlay® is finished with this buffer.
dwReplyDataSize
Size of the data, in bytes, contained in the pvReplyData member.
pvReplyContext
Buffer context for pvReplyData. This value will be passed to the host's message handler with the DPN_MSGID_RETURN_BUFFER message as the pvUserContext member of the associated structure.
pvPlayerContext
Player context preset.
pAddressPlayer
Pointer to an IDirectPlay8Address interface for the connecting player. You must call IDirectPlay8Address::AddRef to increment the interface's reference count. Call IDirectPlay8Address::Release when you no longer need the interface.
pAddressDevice
Pointer to an IDirectPlay8Address interface for the device receiving the connect attempt. You must call IDirectPlay8Address::AddRef to increment the interface's reference count. Call IDirectPlay8Address::Release when you no longer need the interface.

Return Values

Return DPN_OK to allow the player to join the session. Any other return value will reject the requested connection.

Remarks

The hResultCode member of the structure associated with the DPN_MSGID_CONNECT_COMPLETE message that is sent to the player requesting a connection will be set to DPN_OK if the connection was successful. If the connection is rejected, hResultCode will be set to DPNERR_HOSTREJECTEDCONNECTION, not the value you return from this message.

When an DPN_MSGID_INDICATE_CONNECT notification arrives on the host player's message handler, setting pvPlayerContext before returning the thread will preset the player context value on the respective DPN_MSGID_CREATE_PLAYER notification. This feature allows you to pass a player context value to DPN_MSGID_CREATE_PLAYER.

If you set a player context value, that value is not frozen until the subsequent DPN_MSGID_CREATE_PLAYERmessage has been processed. You thus have the option of modifying this player context value when you process DPN_MSGID_CREATE_PLAYER.

If a client drops the connection after the server has processed the DPN_MSGID_INDICATE_CONNECT message but before it has processed DPN_MSGID_CREATE_PLAYER, the server will receive a DPN_MSGID_INDICATED_CONNECT_ABORTED message. If you receive this message, free any memory that you allocated while processing DPN_MSGID_INDICATE_CONNECT. Once DPN_MSGID_CREATE_PLAYER has been processed, this memory should be freed when you process DPN_MSGID_DESTROY_PLAYER.

If you specify a value for pvUserConnectData, you will subsequently be sent a DPN_MSGID_RETURN_BUFFER message to notify you that you can safely free the buffer.

Requirements

  Windows NT/2000/XP: Available as a redistributable for Windows 2000 and later.
  Windows 98/Me: Available as a redistributable for Windows 98 and later.
  Header: Declared in Dplay8.h.