Valhalla Legends Forums Archive | Battle.net Bot Development | [C++] I don't want it!

AuthorMessageTime
bethra
The optional packets like 0x25 and 0x59 that you do not have to respond are a pain.

Ok, I want to filter these damn packets so that I can receive what I the packet(s) that I really need.

Lets just say, I send 0x50.  Then BNet sends me the 0x25 packet.  Then I receive the 0x50 response.

In C++ I have to call recv() and it gets the packet that is sent to me.  I am sent to 0x25 which I do not want.  And basically I have to call recv() two freaking times to actually get the 0x50 response, the data that I really need.

Is there a better way than calling recv() two times just to filter out the 0x25 or 0x59 and get the packet response that I need?
March 21, 2005, 4:28 PM
Networks
why can't you do a simple if statement?
if (packet_id != 0x25 || packet_id != 0x59)
{
  // parsing function here
}
March 21, 2005, 4:52 PM
OnlyMeat
TCP/IP is a sequential protocol, which means you receive the packets in the same order they were sent. So to access the next data chunk on the network stack, you must first pop the chunk before it.

Thats atleast the way i think of it, although it's not really a stack specifically as stacks work on a LIFO basis. It's more of a queue type FIFO system.
March 21, 2005, 5:15 PM
iago
[quote author=OnlyMeat link=topic=10992.msg104785#msg104785 date=1111425338]
TCP/IP is a sequential protocol, which means you receive the packets in the same order they were sent. So to access the next data chunk on the network stack, you must first pop the chunk before it.

Thats atleast the way i think of it, although it's not really a stack specifically as stacks work on a LIFO basis. It's more of a queue type FIFO system.
[/quote]

You have the definition of the TCP/IP stack wrong.  The "stack" is referring to the network layers (physical, data link, address, transport, etc) (yes, I know I call them by the wrong name).  The right term is a "stream".

Anyway, Networks is right, just ignore it if you don't want it.  Calling recv() twice isn't the most horrible thing ever.

You shouldn't actually be depending on the order that stuff is received.  Doing that is a very ba idea.  You should have a single recv() and an event processor.  Don't bother calling any functions if it's not a useful packet.
March 21, 2005, 5:35 PM
St0rm.iD
You may be interested in http://en.wikipedia.org/wiki/Finite_state_machine
March 21, 2005, 5:44 PM
iago
I'm not really sure what you're talking about, but I'll assume it's directed at my last comment.  I don't consider Battle.net to be a finite state machine, except in a few cases.  There are very few packets that have a defined order, though, and it's normally not a good idea to assume that there are any "states".  The real clients don't (as far as I remember) except for "logged in" and "not logged in". 
March 21, 2005, 8:32 PM
UserLoser.
[quote author=iago link=topic=10992.msg104796#msg104796 date=1111437150]
I'm not really sure what you're talking about, but I'll assume it's directed at my last comment.  I don't consider Battle.net to be a finite state machine, except in a few cases.  There are very few packets that have a defined order, though, and it's normally not a good idea to assume that there are any "states".  The real clients don't (as far as I remember) except for "logged in" and "not logged in". 
[/quote]

IIRC, War3's Game.dll holds different states such as in chat, not in chat, in game, changing pssword, logging on, will flood off, and stuff like that
March 21, 2005, 8:53 PM
iago
[quote author=UserLoser link=topic=10992.msg104801#msg104801 date=1111438429]
[quote author=iago link=topic=10992.msg104796#msg104796 date=1111437150]
I'm not really sure what you're talking about, but I'll assume it's directed at my last comment.  I don't consider Battle.net to be a finite state machine, except in a few cases.  There are very few packets that have a defined order, though, and it's normally not a good idea to assume that there are any "states".  The real clients don't (as far as I remember) except for "logged in" and "not logged in". 
[/quote]

IIRC, War3's Game.dll holds different states such as in chat, not in chat, in game, changing pssword, logging on, will flood off, and stuff like that
[/quote]

That's still a pretty crappy FSM.

In any case, I don't see how that has anything to do with the original problem.
March 22, 2005, 12:07 AM
Myndfyr
[quote author=Banana fanna fo fanna link=topic=10992.msg104792#msg104792 date=1111427053]
You may be interested in http://en.wikipedia.org/wiki/Finite_state_machine
[/quote]

Perhaps, but SID_PING and SID_REGISTEREMAIL (that's 0x59 right?) don't actually change the state of the client.  They can change the state of the user's representation on the server, that's all.

The state that IS changed via these packets is whether the machine (client) is processing these packets or receiving more data or whatnot.
March 22, 2005, 12:10 AM
Arta
Battle.net has several states, although they may not be explicit, and oftentimes there are several ways to move between states. I think an FSM could be useful to someone that likes FSMs.

Examples:

Connected, but no key data
Key data sent, but not logon - the interactions between these states would depend on your pruduct (WAR3: dull, DRTL: interesting)
Logon, but not in chat
In chat
Out of chat, but not in a game
in a game, and out of chat
in a game and in chat (An unreachable state, hopefully!)

Another thing I just realised: certain messages are permitted only in specific states. That could be important to someone who wanted to consider that in their design.

Anyway, all I'm trying to say is, the simplicity of a system doesn't negate the usefulness of modelling it, especially if you don't know about the system and you're trying to get a better understanding of it.
March 22, 2005, 12:18 AM
Adron
[quote author=Arta[vL] link=topic=10992.msg104841#msg104841 date=1111450712]
Anyway, all I'm trying to say is, the simplicity of a system doesn't negate the usefulness of modelling it, especially if you don't know about the system and you're trying to get a better understanding of it.
[/quote]

Plus, as soon as you drop multiple threads for a multi-bot program, you're actively developing state machines and tracking the state yourself...
March 22, 2005, 9:48 PM
HdxBmx27
[quote author=Arta[vL] link=topic=10992.msg104841#msg104841 date=1111450712]
in a game and in chat (An unreachable state, hopefully!)
[/quote]
Hurm, It is possible.. And has been done...
~-~(HDX)~-~
March 22, 2005, 10:12 PM
LoRd
[quote author=HdxBmx27 link=topic=10992.msg104994#msg104994 date=1111529562]
[quote author=Arta[vL] link=topic=10992.msg104841#msg104841 date=1111450712]
in a game and in chat (An unreachable state, hopefully!)
[/quote]
Hurm, It is possible.. And has been done...
~-~(HDX)~-~
[/quote]

Once you join or create a game, you are removed from the chatting environment, so no, it hasn't been done.  It's impossible.
March 22, 2005, 10:20 PM
HdxBmx27
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels. The actual client manually leaves the chat when joining games.
But for D1, your right it is impossible. Hurm, I believe it is possible to be in a game, yet still be chatting with SC to...
~-~(HDX)~-~
March 22, 2005, 10:28 PM
LoRd
[quote author=HdxBmx27 link=topic=10992.msg104999#msg104999 date=1111530494]
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels. The avually client manually leaves the chat when joining games.
But for D1, your right it is impossible. Hurm, I bleave it is possible to be in a game, yet still be chatting with SC to...
~-~(HDX)~-~
[/quote]

You can join a game without informing Battle.net, but if you do that, your Battle.net status will not change.
March 22, 2005, 10:47 PM
Myndfyr
[quote author=HdxBmx27 link=topic=10992.msg104999#msg104999 date=1111530494]
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels. The avually client manually leaves the chat when joining games.
But for D1, your right it is impossible. Hurm, I bleave it is possible to be in a game, yet still be chatting with SC to...
~-~(HDX)~-~
[/quote]

What is an "avually client"?

This is NOT a sarcastic question; I really can't figure out what he's trying to say.
March 22, 2005, 10:48 PM
HdxBmx27
Sorry about that, As you all know I have the worst grammar/spelling that anyone has seen in a while >.<
I ment to say "Actual client" (if that is even correct) in refrence to the official products created by Blizzard.
~-~(HDX)~-~
March 22, 2005, 10:53 PM
OnlyMeat
[quote author=HdxBmx27 link=topic=10992.msg105011#msg105011 date=1111532032]
Sorry about that, As you all know I have the worst grammar/spelling that anyone has seen in a while >.<
I ment to say "Actual client" (if that is even correct) in refrence to the official products created by Blizzard.
~-~(HDX)~-~
[/quote]

I could tell what you said. It was actually quite obvious, I believe MyndFyre was being pedantic as usual, trying to display a superior grasp of the english language. Unfortunately we all make mistakes including MyndFyre, which he has done on several occasions.

Here is a nice example:-

[quote author=MyndFyre link=topic=10389.msg98294#msg98294 date=1107587039]
C# really syntesizes a nice combination of Java's elegance with these features
[/quote]

Sorry what were you trying to spell here MyndFyre....?
March 23, 2005, 12:51 PM
Adron
[quote author=OnlyMeat link=topic=10992.msg105100#msg105100 date=1111582317]
I could tell what you said. It was actually quite obvious,
[/quote]

It wasn't obvious to me. An avually client could be some kind of bot.
March 23, 2005, 1:12 PM
OnlyMeat
[quote author=Adron link=topic=10992.msg105103#msg105103 date=1111583571]
[quote author=OnlyMeat link=topic=10992.msg105100#msg105100 date=1111582317]
I could tell what you said. It was actually quite obvious,
[/quote]

It wasn't obvious to me. An avually client could be some kind of bot.
[/quote]

I'll give you a hint, look at how he sets the topic context:-

[quote author=HdxBmx27 link=topic=10992.msg104999#msg104999 date=1111530494]
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels.
[/quote]

Then evaluate the next statement based on the previous context set, including the keywords: client, joining games and D1.

[quote author=HdxBmx27 link=topic=10992.msg104999#msg104999 date=1111530494]
The avually client manually leaves the chat when joining games.
But for D1, your right it is impossible.
[/quote]

The combination 'avually' at first glace looks like actually, missing the 't', and with a 'v' inplace of the 'c', so lets look at how the sentence starts, with the word 'The'.

If we read that as 'The actually client', we could simply correct the sentence grammer to read 'The actual client', or you could assume by reading the sentence that he intended it to be 'The actual client'.

I did this automatically when i read it.

Understand now?
March 23, 2005, 3:10 PM
Adron
[quote author=OnlyMeat link=topic=10992.msg105114#msg105114 date=1111590618]
I'll give you a hint, look at how he sets the topic context:-

[quote author=HdxBmx27 link=topic=10992.msg104999#msg104999 date=1111530494]
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels.
[/quote]
[/quote]

OK, following here, he's excluding D2.


[quote author=OnlyMeat link=topic=10992.msg105114#msg105114 date=1111590618]
Then evaluate the next statement based on the previous context set, including the keywords: client, joining games and D1.

[quote author=HdxBmx27 link=topic=10992.msg104999#msg104999 date=1111530494]
The avually client manually leaves the chat when joining games.
But for D1, your right it is impossible.
[/quote]
[/quote]

OK, D1 is excluded too. That leaves the Starcraft series of games.


[quote author=OnlyMeat link=topic=10992.msg105114#msg105114 date=1111590618]
The combination 'avually' at first glace looks like actually, missing the 't', and with a 'v' inplace of the 'c', so lets look at how the sentence starts, with the word 'The'.

If we read that as 'The actually client', we could simply correct the sentence grammer to read 'The actual client', or you could assume by reading the sentence that he intended it to be 'The actual client'.

I did this automatically when i read it.

Understand now?
[/quote]

Actually, in the Starcraft game/bot/hack context set, avually at a quick glance looks like "autoally". But you're right, going back to check it over a few times makes it reasonable to assume he actually meant "actual". For being as why it time for to read and interpretation possibly increases can, the Sloppy grammars and splelings should avoidance be though.
March 23, 2005, 4:52 PM
iago
I have to agree with Adron et al.  I had no idea what it meant :)
March 23, 2005, 5:41 PM
KkBlazekK
Where did the T in Actually go in your post hdx?
March 23, 2005, 8:48 PM
HdxBmx27
-.-
Will you all stop this. I explained what I meant. I am deeply sorry for the errors in my posts. And I want to forewarn all of you, I will be making a lot of them in the future. As for the 'v' notice on most normal keyboards sold in America (most English countries i believe) is the first button to the right of 'c'. That explains the 'v' as for the missing 't' that button sticks for me a lot. (had to press it quite a few times to type this post).
Now can we either get back on topic, or stop talking about my shitty linguistic skills?
(Yes I did do a spell check on this, Probably didn't help.)
~-~(HDX)~-~
March 23, 2005, 10:04 PM

Search