• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: UDP Sockets & Clock Synchronization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UDP Sockets & Clock Synchronization


  • Subject: Re: UDP Sockets & Clock Synchronization
  • From: Ricardo Cabral <email@hidden>
  • Date: Tue, 26 Feb 2002 14:24:17 -0100

On Terga, Fevereiro 26, 2002, at 04:44 , Zack Morris wrote:

Hi, I am messing with sockets on OS X and I need a way to have an
"interrupt" that fires when a UDP packet comes in. Using select() doesn't
really help, because if my game runs at 30 fps, that means I have a 33ms
uncertainty about when a packet came in (if I poll the network each time
through my main loop). I need something similar to the asynch mode of OS 9.
That's because I send out a "ping" packet (using UDP) with the current time.
Ont the other end, the server needs to see the packet come in and return a
response packet as quickly as possible to mimimize the latency. The
original computer gets that response packet and looks at the server's time
and round trip time to compute how much to change the clock by. Obviously
throwing an extra 33ms in there doesn't help! Is there a way to do this?

i do it having an additional child process (or thread) that i called when the level is started which receives the packets and assigns them to a structure with the game time and puts it into a fifo or in a network socket
then, in the game loop i call a function to get one packet struct and do the stuff i need (comparing with the current time to see if the packet is still valid, updating the object database, etc..).
That child process could also send ping packets, if you want..

P.S. It would be nice if this worked with GUSI so I could have one method,
but it's not mandatory...thanx for your time,

what is that? :)

hope this helps..

----
."-. Cumprimentos (regards)
/X | _o.----. _ Ricardo Cabral - NightDog
/\_ \/ / __ \_// ) Someone Said the Internet was like Oxygen
\__)-/_/\_____)____/ I breath the Internet
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >UDP Sockets & Clock Synchronization (From: Zack Morris <email@hidden>)

  • Prev by Date: Re: DNR
  • Next by Date: Re: UDP Sockets & Clock Synchronization
  • Previous by thread: RE: UDP Sockets & Clock Synchronization
  • Next by thread: Re: UDP Sockets & Clock Synchronization
  • Index(es):
    • Date
    • Thread