• Welcome to Valhalla Legends Archive.
 

Need Help

Started by PhoeNix_FasT, September 15, 2006, 04:26 PM

Previous topic - Next topic

PhoeNix_FasT

Ok first im programming with C++ and i simply want to connect to europe.battle.net and did this so far :


#include <winsock2.h>
#include <windows.h>
#include <iostream.h>
#include <string.h>

#pragma comment(lib,"wsock32.lib")

int main()
{
char *ip;
long rc;

WSADATA wsa;
WSAStartup(MAKEWORD(2,0),&wsa);
SOCKET s;
SOCKADDR_IN addr;
HOSTENT* EuropeBattleNet;

memset(&addr,0,sizeof(SOCKADDR_IN));
s=socket(AF_INET,SOCK_STREAM,0);
he=gethostbyname("europe.battle.net");
ip = inet_ntoa( *(LPIN_ADDR)*EuropeBattleNet->h_addr_list );

addr.sin_family=AF_INET;
addr.sin_port=htons(6112);
addr.sin_addr.s_addr=inet_addr(ip);

cout<<"Trying to connect to europe.battle.net "<< ip <<"\n\n";

rc=connect(s,(SOCKADDR*)&addr,sizeof(SOCKADDR));

if(rc==SOCKET_ERROR)
cout<<"Error";
else
cout<<"Connected !\n";

return 0;
}


Now i read about SID_AUTH_INFO ( http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=2 )

(DWORD)       Protocol ID (0)
(DWORD)       Platform ID
(DWORD)       Product ID
(DWORD)       Version Byte
(DWORD)       Product language
(DWORD)       Local IP for NAT compatibility*
(DWORD)       Time zone bias*
(DWORD)       Locale ID*
(DWORD)       Language ID*
(STRING)     Country abreviation
(STRING)     Country

Now i have to use send(socket,thingtosend,MAX_PATH,0); for every thing ? ( i mean for every listed thing (protocol id etc) )
Its so hard to understand for me :(