• Welcome to Valhalla Legends Archive.
 

Battle.net Chat Protocol Issues?

Started by TheMinistered, April 04, 2004, 11:34 PM

Previous topic - Next topic

TheMinistered

Telos and I were working on a socket library for generic use.  I was testing it on battle.net using overlapped sockets and I kept running into a problem.  Here is some logs:

This is the normal data you should receive from battle.net upon connection.  NAME packet, CHANNEL packet, USER packet(s).
Quote
Connection from [68.47.226.172]

Enter your account name and password.
Use 'anonymous' if you only want to issue queries.

Username: ;i
Password:

2010 NAME ;i
1007 CHANNEL "Public Chat 1"
1001 USER tbd-cokes-king 0000 [SEXP]
1001 USER The-Brethren#2 0010 [CHAT]

...


However, I was experiencing a problem receiving data upon connection.  I was not receiving the NAME packet, CHANNEL packet, and some USER packet(s).
Quote
Connection from [68.47.226.172]

Enter your account name and password.
Use 'anonymous' if you only want to issue queries.

Username: ;i
Password:

1001 USER lsucmlsh 0000 [SEXP]
1001 USER ;i 0010 [CHAT]

...

After becoming extremely frusterated,  I went to op [vL] and asked for some help and I got a little here and there.  Eventually, I ended up relying on my self to fix the problem.

I determined, after much testing, that WSASend was causing the phenomena with WSARecv.

I was invoking the function like so:

// send function-prototype
Send(BYTE* lpData, DWORD dwSize);

// example of wrong invokation
char Login[] = "c;i\rxxxx\r";
Send(Login, 10);


The problem with the code above, is that it was sending the null terminator along with the data.  I can only assume that this caused the problem, because invoking send like so cures the problem:

// example of right invokation
char Login[] = "c;i\rxxxx\r";
Send(Login, 9);


Does anyone know why sending the null terminator causes this phenomena?

Adron

You should send the null terminator and then packetlog and see if you're getting the right data, or if the null terminator is interpreted by battle.net to do something strange...

iago

I was also going to suggest packetlogging, preferably with your program.  If you need a c++ function to dump out pretty output, let me know, I'll send you mine on aim.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*