Jump to content
  • Advertisement
Sign in to follow this  
Prozak

Winsocks: Send Methodology

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

I'm experiencing packet-loss on an app I'm developing, on the receiving side. On the sending side, all I'm doing is reading from a file, and sending, no stops. Is this wrong? Should I wait for a "packet-received" message before sending another one out? Or does Windows handle this with a buffer on the receiving end? On the receiving end, I get some packets, and lose some packets, but I can't precise exactly what is going wrong...

Share this post


Link to post
Share on other sites
Advertisement
Are you losing packets, or just some of the information?

One of the things to check is that the send function is definitely sending everything in your buffer. For example, you might read 2048 bytes and call send. send might only send 1024 of those in one call. If you assume that it has sent all 2048 and send the next 2048, you will have lost 1024 bytes.

Other than that, nothing obvious comes to mind.


btw - good luck tonight! ;)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Is the function "send" or "sendto"?
If send then you are using TCP in which you really shouldn't loose any packets, we maybe able to see the problem if we could see your code.
If your code is not error checking socket functions and returns don't expect much help!

Share this post


Link to post
Share on other sites
ah! I wasn't thinking of the send size, and was sending packets of 8Kb in size, maybe a bit too big for the send command.

Ps: Thanks, I really apreciate that coming from an English soccer fan. Let's see what the Gods have instore for us tonight [wink]

Share this post


Link to post
Share on other sites
hmmm... ok...

...but how does one proceed when the Send function returns a value that is not the amount of bytes you intended to send?

Share this post


Link to post
Share on other sites
I've reduced the packet size, and now I have on the Sending side a delay, so that I don't "swamp" the receiving side with data.

How do I manage to send data as fast as the receiving side can manage it?

If I just read from the file and send it off, then I think the buffer on the receiving side gets an overflow...

Share this post


Link to post
Share on other sites
...should I, on the receiving end, send out a "I've got your latest packed" message, or something along those lines?

...so that the sender can pace itself and not overflow the receiver?

Share this post


Link to post
Share on other sites
You know instead of trying to reimplement TCP/IP, you might want to just use TCP/IP.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
You know instead of trying to reimplement TCP/IP, you might want to just use TCP/IP.


I am!

Ok, a bit of background on this then. This is an utility designed to transmit data, including large files, from a PDA to a PC, using winsocks and TCP/IP Protocol.

It's designed in such a way that allows two threads to have a communications-line between them. A thread on the PDA can talk to another thread on the PC. Each of these CommThreads has an in-Buffer with an Event attached, so that they can wait for something to arrive on that buffer, without using CPU time.

A master CommThread using a base protocol on top of TCP/IP knows which packets are to go to which buffers, and signals those buffers, so that any Thread waiting on data to arrive can awaken and process it.

So, it makes heavy use of threads, mutexes, events, etc... pretty complex design making bug-catching a royal pain in the behind...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!