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?
why can't you do a simple if statement?
if (packet_id != 0x25 || packet_id != 0x59)
{
// parsing function here
}
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 from: OnlyMeat on March 21, 2005, 11:15 AM
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.
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.
You may be interested in http://en.wikipedia.org/wiki/Finite_state_machine
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 from: iago on March 21, 2005, 02:32 PM
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".
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 from: UserLoser on March 21, 2005, 02:53 PM
Quote from: iago on March 21, 2005, 02:32 PM
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".
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
That's still a pretty crappy FSM.
In any case, I don't see how that has anything to do with the original problem.
Quote from: Banana fanna fo fanna on March 21, 2005, 11:44 AM
You may be interested in http://en.wikipedia.org/wiki/Finite_state_machine
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.
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.
Quote from: Arta[vL] on March 21, 2005, 06:18 PM
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.
Plus, as soon as you drop multiple threads for a multi-bot program, you're actively developing state machines and tracking the state yourself...
Quote from: Arta[vL] on March 21, 2005, 06:18 PM
in a game and in chat (An unreachable state, hopefully!)
Hurm, It is possible.. And has been done...
~-~(HDX)~-~
Quote from: HdxBmx27 on March 22, 2005, 04:12 PM
Quote from: Arta[vL] on March 21, 2005, 06:18 PM
in a game and in chat (An unreachable state, hopefully!)
Hurm, It is possible.. And has been done...
~-~(HDX)~-~
Once you join or create a game, you are removed from the chatting environment, so no, it hasn't been done. It's impossible.
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)~-~
Quote from: HdxBmx27 on March 22, 2005, 04:28 PM
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)~-~
You can join a game without informing Battle.net, but if you do that, your Battle.net status will not change.
Quote from: HdxBmx27 on March 22, 2005, 04:28 PM
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)~-~
What is an "avually client"?
This is NOT a sarcastic question; I really can't figure out what he's trying to say.
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 from: HdxBmx27 on March 22, 2005, 04:53 PM
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)~-~
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 from: MyndFyre on February 05, 2005, 01:03 AM
C# really syntesizes a nice combination of Java's elegance with these features
Sorry what were you trying to
spell here MyndFyre....?
Quote from: OnlyMeat on March 23, 2005, 06:51 AM
I could tell what you said. It was actually quite obvious,
It wasn't obvious to me. An avually client could be some kind of bot.
Quote from: Adron on March 23, 2005, 07:12 AM
Quote from: OnlyMeat on March 23, 2005, 06:51 AM
I could tell what you said. It was actually quite obvious,
It wasn't obvious to me. An avually client could be some kind of bot.
I'll give you a hint, look at how he sets the topic context:-
Quote from: HdxBmx27 on March 22, 2005, 04:28 PM
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels.
Then evaluate the next statement based on the previous context set, including the keywords: client, joining games and D1.
Quote from: HdxBmx27 on March 22, 2005, 04:28 PM
The avually client manually leaves the chat when joining games.
But for D1, your right it is impossible.
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 from: OnlyMeat on March 23, 2005, 09:10 AM
I'll give you a hint, look at how he sets the topic context:-
Quote from: HdxBmx27 on March 22, 2005, 04:28 PM
Well If your running through D2GS then no, Login to a realm game, and you can still chat in normal channels.
OK, following here, he's excluding D2.
Quote from: OnlyMeat on March 23, 2005, 09:10 AM
Then evaluate the next statement based on the previous context set, including the keywords: client, joining games and D1.
Quote from: HdxBmx27 on March 22, 2005, 04:28 PM
The avually client manually leaves the chat when joining games.
But for D1, your right it is impossible.
OK, D1 is excluded too. That leaves the Starcraft series of games.
Quote from: OnlyMeat on March 23, 2005, 09:10 AM
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?
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.
I have to agree with Adron et al. I had no idea what it meant :)
Where did the T in Actually go in your post hdx?
-.-
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)~-~