Microsoft DirectX 8.1 (C++) |
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.
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;
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 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.
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.