🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

datagram socket

Started by
0 comments, last by Dogen 22 years, 8 months ago
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
Advertisement
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.
------------------------------------------------------------I wrote the best video game ever, then I woke up...

This topic is closed to new replies.

Advertisement