Pausing a program - poll/sleep/threads?

Simon John simoninusa2001 at yahoo.co.uk
Thu Feb 17 23:07:21 EST 2005


Jeff Shannon wrote:

[snip]
> The amount of bandwidth and server load that will be used by a
> once-a-second query is probably pretty trivial (unless you're
> expecting this to run over internet or dialup networks -- and even
> then, it's probably not going to be worth worrying about).  Even on
an
> old 10Mbit ethernet connection, a couple of extra packets every
second
> will not make a notable difference.  This (IMO) is premature
> optimization.  :)

It is designed to work over 802.11b (so under 11Mbit).

I'm going to fire up Ethereal later and see how much traffic this would
cause, most of the commands are only about 30bytes long, and the
longest response would be the filename, it just seems to me that
polling a server once every second or two, is kinda like a DDoS....

[...]
> But does the server push events to the client?  If there's a
> filesystem error while a track is playing, how does your client know
> about it?  In addition, what happens if XMMS segfaults, or the server

> machine loses power?

No, this is not server push, the client must query the server. Plus the
InetCtrl plugin does seem to segfault quite a lot, resulting in a
socket exception - I'll have to make sure that the client stops
querying the server after a socket excption, and doesn't keep trying
(resulting in lots of error dialogs!)

[...]
> One of the big questions here is whether your client will have
> exclusive access to the XMMS server.  That is, will it be possible
for
> more than one such client to connect to the same XMMS, and/or for
XMMS
> to have direct interaction on its host machine?

No, you can have multiple connections to the server, and you can use
XMMS directly, so it would be possible for the client to miss events.

[...]
> I really think that you *do* want to do fairly frequent status checks

> with your server.  The cost is small, and the gains in responsiveness

> and robustness are potentially very significant.

Yes, I'm coming around to this POV too, but I still don't know how to
implement it (querying every 2 seconds say) in a multi-tasking manor -
as I said, sleep() hangs up the GUI, and alarm() is not portable....

Thanks for your suggestions.




More information about the Python-list mailing list