socket and DynDNS

S

Stephan Schulz

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 someserver.dyndns.org 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 ("someserver.dyndns.org", 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
long?

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!

Bye,

Stephan
 
M

Martin v. Löwis

My naive and ugly alternative is to periodically (e.g. every 5
minutes) do a manual lookup and use the last address.

You should look at the TTL of the DNS record, and re-lookup when it
expires.

There will be *no* kind of protection for UDP messages. When
the machine loses its IP address, it will stop receiving your
messages, even if they are already in transit. If the provider
re-assigns the IP address to some other customer, that customer
will receive the UDP messages instead.

If you want safety, you need to implement it in your application,
e.g. by the receiver side sending heart beat messages, and the
sender side resending everything that might have been lost since
the last heart beat.

Regards,
Martin
 
S

Stephan Schulz

You should look at the TTL of the DNS record, and re-lookup when it
expires.

Sure. I can do that. But it would be so much nicer if a lower level
would already take care of that (i.e. by caching the lookup for the
lease time and then renewing the info).
There will be *no* kind of protection for UDP messages. When
the machine loses its IP address, it will stop receiving your
messages, even if they are already in transit. If the provider
re-assigns the IP address to some other customer, that customer
will receive the UDP messages instead.

Indeed. I'm aware of that. The data is not particularly critical, so a
short outage or some misdirected data is not much of an issue
(although I'd like to avoid sending random packets to some
unsuspecting victim, if only to not scare some poor virus scanner).
If you want safety, you need to implement it in your application,
e.g. by the receiver side sending heart beat messages, and the
sender side resending everything that might have been lost since
the last heart beat.

Right. We don't need that safety. Indeed, this is for an external
convenience feed. For the real application, we have a controlled
environment, and loosing the occasional packet is much less critical
than the overhead and delays of a safe protocol. But this is getting
off-topic.

Bye,

Stephan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top