Jump to content
  • Advertisement


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


datagram socket

This topic is 6170 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 hello i have some problem with datagram packages. i get a huge delay, from that i send till the packages arrives, i´ll explain my program: while(true) { pause for five millisekonds() send a package every twize() receive a package() } my socket is non-blocking and set with TCP_NODELAY i don´t understand why my package sometimes is received about 3 seconds later then it was sent. can someone help me with this please. /dogen

Share this post

Link to post
Share on other sites
Well, I see three problems.

First. It doesn''t look like your program is time based. Let me put it this way. If my PC take 2 milliseconds to proccess the game loop plus the 5 milli-seconds you tag on. That means you should get packets 7 milli-seconds apart. where as if your computer takes 10 milli-seconds to do the game loop. I will get a packet every 15 milli-seconds. This will cause major lag. So.. Send packet every X milli-seconds don''t just delay the game loop. Also try to keep packets set per second under 10 or 15.

Second. You have to realize your on the internet. Packets lag end of story.On a LAN lag is about 10 to 40 millseconds depending on packet size and and speed of the adapter. Internet lag is alot worse. 50 to 70 milliseconds for a Cable or other broadband line. DSL Modems are about 70 to 200 milliseconds and convetional modems can be horrific 200 milliseconds to 1000''s of milliseconds.

Third. Tf you are sending. 800 byte packets every 10 milliseconds on a 56k line. You have to wait till the 50 bytes you have the bandwith to send clears out.. so the packet will take about a 5th of a second to get out. Plus FYI big datagram packets != Smart.

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!