socket and DynDNS

Stephan Schulz schulz at
Wed Oct 22 16:54:31 CEST 2008

Hi all,

I need an application that will duplicate an incoming stream of UDP
messages and send it on to some external server that has a dynamic DNS
address. I can use the dynamic name to get the
current IP address or to send data too.

The question I have is how to do this in the most elegant way. What
happens if I just use the tuple ("", someport) as
the address in socket.sendto()? Will the library do the right thing
every time? I.e. will it cache the IP address long enough, but not too

I'm potentially sending off thousands of messages per second - almost
certainly hundreds. Will someone in the chain do a smart enough
caching that a) a change in the IP address will be noted and b) I
don't incur a full DNS resolution overhead for each packet?

My naive and ugly alternative is to periodically (e.g. every 5
minutes) do a manual lookup and use the last address. This may, of
course lead to a service outage if the address changes, but that is
supposed to be a rare event and is deemed acceptable.

Oh yes, the OS is Red Hat EL5, if that makes a difference with respect
to the underlying name resolution.

Thanks for any input!



-------------------------- It can be done! ---------------------------------
       Please email me as schulz at (Stephan Schulz)

More information about the Python-list mailing list