Sockets

Mike Meyer mwm at mired.org
Thu May 5 05:43:18 EDT 2005


Dan <dan at dontspammecauseidontlikit.com> writes:

> I think that the best way to send the notification to this server
> application is via a udp message.  Alternatively, I could use tcp, but
> I don't think I'll need the extra complexity for what I want to do.
> (Other suggestions welcome.)

upd isn't reliable. If you need reliability, you'll have to build it
yourself. In which case, it might be easier to use tcp.

> My problem is how to also listen on a udp port while the process is
> blocked by 'select'.  Should I run a separate thread?  And if so can I
> share the socket connection across the two threads?  (Thread 1 will be
> accepting client connections, thread 2 will we writing data to it.)
> Or should I simply let 'select' time out after some period?

A udp port is just another socket - meaning another file
descriptor. Unix being what it is, I'd expect that select would handle
sockets opened for udp just fine. Have you tried that and had it fail?

     <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list