• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

directplay how to bypass the enumconnection and the enumsession

Hello All i can do a small program like a chat with the dialog that ask the user to
choose their provider like tcpip or IPX or .... and assk the user to choose the session
in this provider. but i dont want to do it each time i connect

what should i do to connect directly to a server like a tcpic computer via a specific address

thanks
0
diplodocus
Asked:
diplodocus
  • 2
1 Solution
 
chensuCommented:
0
 
chensuCommented:
Rejected without any comments. What do you want?
0
 
AdrianBrownCommented:
You need to create a IDirectPlayLobby interface and use the CreateCompoundAddress() function.  I use code similar to this.

char m_lpConData[256];
char m_lpConAddr[256];
DPCOMPOUNDADDRESSELEMENT m_lpAddressElements[16];

// Reset the data
void Reset(void)
{
    m_nCurConElement = 0;
    m_lpConDataPtr = m_lpConData;
}

// To add to the address
void AddConData(GUID guid, int nDataSize, char *szData)
{
    // Add the next element
    m_lpAddressElements[m_nCurConElement].guidDataType = guid;
    m_lpAddressElements[m_nCurConElement].dwDataSize = nDataSize;
    m_lpAddressElements[m_nCurConElement].lpData = m_lpConDataPtr;

    // Copy the data
    memcpy(m_lpConDataPtr, szData, nDataSize);

    // Now increase the pointers
    m_nCurConElement++;
    m_lpConDataPtr += nDataSize;
}

To create say a TCPIP connection you would do

ResetData();
AddConData(DPAID
_ServiceProvider, sizeof(GUID), DPSPGUID_TCPIP);
AddConData(DPAID_INet, 13, "192.168.1.36");

int nTotalSize = 256;

lpDirectLobby->CreateCompoundAddress(m_lpAddressElements, m_nCurConElement, m_lpConAddr, &nTotalSize);

lpDirectLobby->InitializeConnection(m_lpConAddr, 0);

This sets up a compound address with the provider of TCPIP and the address to connect to.  The address is then created and initialised.

Hope this helps, for more info see the SDK
DirectPlay->DirectPlay Essentials->DirectPlay Address
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now