• Advertisement

Archived

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

Recving entire packets

This topic is 6023 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

Advertisement
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

  • Advertisement