Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Recving entire packets

This topic is 6252 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What do you mean by:
"how can you be guaranteed that the server will even get the whole size?"

The actual size variable in the header, or the packet data?

The size variable should be a byte or a word, dont think you would need more than that. So you read until you got it.

Then, when you got the size of the data, you keep reading until you have received that amount of bytes, or a timeout occurs.

Thats how I would do it anyway.

Share this post

Link to post
Share on other sites
Yeah, that''s what I ended up doing. I just wasn''t thinking clearly.

For simplicity I just made a function which calculated packet size from the packet type, which is the first byte in each packet. Now when a single byte is received my program knows what kind of packet it''s dealing with _and_ how big it is.

Thanks for your help.

And yeah, I''m rileyriley from uniball.

Share this post

Link to post
Share on other sites
Yea, that makes sense. The only packet I can think of that really
needs variable length is a chatmessage packet.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!