Microsoft DirectX 9.0 SDK Update (Summer 2003) |
DPN_MSGID_INDICATE_CONNECT Message
Microsoft® DirectPlay® generates the DPN_MSGID_INDICATE_CONNECT message when a player attempts to connect to a peer-to-peer or client/server session.
The DPNMSG_INDICATE_CONNECT structure contains information for the DPN_MSGID_INDICATE_CONNECT system message.
Syntax
typedef struct _DPNMSG_INDICATE_CONNECT { DWORD dwSize; PVOID pvUserConnectData; DWORD dwUserConnectDataSize; PVOID pvReplyData; DWORD dwReplyDataSize; PVOID pvReplyContext; PVOID pvPlayerContext; IDirectPlay8Address *pAddressPlayer; IDirectPlay8Address *pAddressDevice; } DPNMSG_INDICATE_CONNECT, *PDPNMSG_INDICATE_CONNECT;
Members
- 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 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.
Remarks
Return DPN_OK to allow the player to join the session. Any other return value will reject the requested connection.
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 S_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_PLAYER message 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. When 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.
Message Information
Header dplay8.h Minimum operating systems Windows 98, Pocket PC 2002