Jump to content
  • Advertisement

Archived

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

C0UNT Z3R0

Winsock EOF msg?

This topic is 5237 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
If the data happens to contain the character sequence "EOF," or if the message "EOF" happens to be fragmented and delivered as first "EO" and then "F", this scheme might not work very well for you.

Instead, you should know the size of the stream up-front, and send a byte count first, followed by the data. The receiving end can then read the byte count, followed by that many bytes of data.

If you want to allow clients to connect "at any time" then you probably want to packetize your stream in multiple packets, each of which is smaller, and each of which has a leading byte count. You could make the rule that a byte count of 0 means "end of stream". When someone connects, they''ll start receiving whole packets from wherever they''re starting, each of which has a length, followed by that amount of data.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!