Jump to content
  • Advertisement

Archived

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

Zoot

Winsock...

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

Hi, I am having a problem with reading the incoming data... i use: "send (ctClient.ClientSocket, sendbuffer, strlen(sendbuffer), 0);" to send the data and then to read: "int err = recv(ctClient.ClientSocket, packet, sizeof(packet), 0 );" My qestion is: is it possible to only read one packet at once? And if it, how? Thanks, Zoot

Share this post


Link to post
Share on other sites
Advertisement
If I read this right then you''re talking about stream sockets. Stream sockets don''t base on packets until a long way down the layers. You don''t read packets but data that was recieved on a stream since the last read() or estalbishing the link.
You basically could try to implement some kind of protocol (like putting the length of the sent data at the beginning of a send-buffer) if you need it. A good point to start at (though perhaps not so much for winsock) would be Beej''s Guide to Network Programming.

Share this post


Link to post
Share on other sites
I believe there are no guarantees how much data you will get per call with recv except it will be less than or equal to your declared buffer size. Just keep calling recv until you receive 0 bytes.

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!