Directplay8:: How to connect to server without lobby?
in the dx sdk directplay8 tutorial "Send", it only has the option of using a lobby to connect to a server. But i want to just enter the address and port instead.
How would i do this? like what code to set the address and port?
Thanks,
"i know this is sorta a dx question but i posted it a while ago and no one answered. I don''t think ive got one answer from any of my questions on directplay yet in the dx forum!"
In the IDirectPlay8Address for the remote host you use in the Connect() call {second parameter}, just specify the SP, HOSTNAME and PORT:
Just don''t forget your HOSTNAME will have to be in UNICODE form.
-cb
l_hr = l_pRemoteHost->SetSP( &CLSID_DP8SP_TCPIP );l_dwPort = in_pInfo->m_usPort;l_hr = l_pRemoteHost->AddComponent(DPNA_KEY_HOSTNAME,l_wszRemoteName,((int)::wcslen(l_wszRemoteName)+1)*sizeof(WCHAR),DPNA_DATATYPE_STRING);l_hr = l_pRemoteHost->AddComponent(DPNA_KEY_PORT,&l_dwPort,sizeof(DWORD),DPNA_DATATYPE_DWORD);
Just don''t forget your HOSTNAME will have to be in UNICODE form.
-cb
The DirectPlay API is in UNICODE so that it works across OS versions and markets using the same DLL binaries. What you send to remote machines using SendTo() is in binary, and you can put everything you want in there.
-cb
-cb
this is part of the code that you gave me exep for the phostaddress, thats from the send tutorial.
IDirectPlay8Address* pHostAddress =NULL;
pHostAddress->SetSP( &CLSID_DP8SP_TCPIP )
anyway i get an access violation only on this code :
pHostAddress->SetSP( &CLSID_DP8SP_TCPIP )
any idea why it would do that? thanks
IDirectPlay8Address* pHostAddress =NULL;
pHostAddress->SetSP( &CLSID_DP8SP_TCPIP )
anyway i get an access violation only on this code :
pHostAddress->SetSP( &CLSID_DP8SP_TCPIP )
any idea why it would do that? thanks
dont worry i accidently was calling it twice, thanks for the code by the way
Another question how would i set the l_wszRemoteName?
im using this to convert it
DXUtil_ConvertGenericStringToWideCch
and tchar as the string of which i put the address name in. But do i put the address name as a string in tchar or an array eg no end of line thing /0 i think it is
im using this to convert it
DXUtil_ConvertGenericStringToWideCch
and tchar as the string of which i put the address name in. But do i put the address name as a string in tchar or an array eg no end of line thing /0 i think it is
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement