Battle.net R&D > Diablo 3

need help, with packet sending(diablo3)

(1/1)

Creepman:
hello peoples,

i made a tcp server which can send messages with send and recv in c++


--- Code: ---int startWinsock(void);
int handling(int c);


int main(int argc, char *argv[])
{
long rc;
int s, c, cli_size;
struct sockaddr_in srv, cli;

if (argc != 2)
{
fprintf(stderr, "usage: %s port\n", argv[0]);
return 1;
}

rc=startWinsock();
if(rc!=0)
{
perror("startWinsock failed()");
return -1;
}
printf("Winsock gestartet\n");

s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1)
{
perror("socket() failed");
return 2;
}
printf("Socket erstellt\n");

memset(&srv,0,sizeof(SOCKADDR_IN));
memset(&cli,0,sizeof(SOCKADDR_IN));

srv.sin_addr.s_addr = INADDR_ANY;
srv.sin_port = htons( (unsigned short int) atol(argv[1]));
srv.sin_family = AF_INET;

if (bind(s, (SOCKADDR*)&srv, sizeof(srv)) == -1)
{
perror("bind() failed");
return 3;
}
printf("bind erstellt\n");

if (listen(s, 3) == -1)
{
perror("listen() failed");
return 4;
}
printf("listen erstellt\n");
for(;;)
{
cli_size = sizeof(cli);
c = accept(s, (SOCKADDR*)&cli, &cli_size);
if (c == -1)
{
perror("accept() failed");
return 5;
}

printf("client from %s\n", inet_ntoa(cli.sin_addr));
if (handling(c) == -1)
{
fprintf(stderr, "%s: handling() failed", argv[0]);
return -1;
}



closesocket(c);
}

return 0;
}

int startWinsock(void)
{
WSADATA wsa;
return WSAStartup(MAKEWORD(2,0),&wsa);
}
--- End code ---

it works to send standart messages
with this function

--- Code: ---int handling(int c)
{
char buffer[BUFFER_SIZE];
char Pstring[BUFFER_SIZE]="hello";
int bytes;

strcpy_s(buffer, Pstring);
bytes = send(c, buffer, strlen(buffer), 0);
if(bytes == -1)
return -1;
return 0;
}
--- End code ---

but i dont know how to send this packet dump, which i got from wireshark when i log in d3

--- Code: ---char Pstring[6]=".OOOC";
--- End code ---

can you help me please, which functions i need to simulate the bnet packets, i only want pass to char screen :-)

Navigation

[0] Message Index

It appears that you have not registered with DarkBlizz - Making Battle.net Magic -. To register, please click here...
Go to full version