socket.recvfrom() & sendto()

Alex Martelli aleaxit at yahoo.com
Thu May 10 10:57:37 CEST 2001


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:_rrK6.1175$Yu6.294589 at newsc.telia.net...
    ...
> > want to select() on keyboard+mouse and get any event that belongs
> > to your graphic application?
>
> fwiw, Windows has extensive support for select-style synchronization
> using all sorts of event sources (files, serial channels, console devices,
> timers, jobs/processes/threads, custom event objects, etc).  it's just
> that they use object handles for everything, not small positive
integers...

Excellent summary!  Just for completeness, you may also throw
mouse and keyboard activity in the sync funnel (and much else
besides) by using MsgWaitForMultipleObjects() as your cornerstone
API call in the message loop of your application or thread.  But
making full use of these capabilities is not really compatible
with using the select() call made available by the Windows socket
library (for compatibility with Unix &c) -- the whole caboodle
would really have to be redesigned (using asynchronous sockets
that let the application know when a call is finished by posting
a message to the msg queue, for example) to a point which would
not make it easy to keep everything cross-platform, with just
rather localized 'platform-specific' portions.  Sigh.


Alex






More information about the Python-list mailing list