socket module and broadcasts ?

Steve Holden sholden at holdenweb.com
Fri May 31 10:01:43 EDT 2002


"Markus von Ehr" <markus.vonehr at ipm.fhg.de> wrote in message
news:3CF780D6.DFEDCFB7 at ipm.fhg.de...
> Hi everybody,
>
> my python client has to connect to a server on an
> embedded system (TCPIP).
> The IP-address of the server may change and I'd like
> to get the address with a broadcast. A friend told me that
> broadcast-messages are only possible using UDP, anyone
> already did a IP-number query?
>

When you say "I'd like to get the address with a broadcast", what protocol
were you thinking of using? Do you really want your server to have top
listen for broadcasts from potential clients? What if the server and the
client are of different IP networks? It's correct that UDP can broadcast and
TCP can't, because the latter assumes a direct process-to-process connection
with acknowledgements, and there is no way to handle multi-host
acknowledgements.

    Q: What are hostnames for?

    A: Making it easier to refer to systems, and retaining invariant
         host references in the face of changing IP allocations.

Use /etc/hosts or the DNS and *name* the hosts. You will only make trouble
for yourself by hard-wiring IP addresses into your code.

even-the-DNS-root-servers-have-names-(though-you-still-need-[at-least-one-of
]-the-addresses)-ly y'rs  - steve
--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list