[Pyro] Newbie Question Regarding Pyro
tim.golden at viacom-outdoor.co.uk
Fri Jan 7 17:32:37 CET 2005
| I'm putting together a new project which I'm using to learn
| Python and have questions about pyro.
You're welcome to ask here, but you might find that
posting on Pyro's own mailing list produces answers
from people who don't follow c.l.py's higher traffic.
| If the server needs to send an unsolicited ad hoc message to
| a given client, is this possible?
| (New message or a reminder, for instance) I suppose I
| could poll a server side list from the client but I'm
| wondering if the server can initiate the exchange.
I think you want to look at the Pyro's Event server,
but be careful with terms like Server and Client, because
they aren't always so straightforward in the Pyro context.
| Also, if a client wishes to converse with another particular
| client (in a chat or IM situation, for instance).
| What's a good mechanism for this?
There are two things here: finding out what "client" (Pyro
object) is out there; and communicating with it. To take
the second one first, once you've found it, you *are*
talking directly to it, so that's fine. To address the
first point, though, finding it can either be through the
nameserver, which is generally preferable since that's
what it's there for, or -- if you know the other object's
location and name -- by using the PYROLOC:// mechanism.
The only thing with this second approach is that you're
likely to find yourself reinventing the name server as
you try to keep track of who's "on-line" etc. (assuming
your typical IM situation). So I'd recommend going for
the nameserver if possible.
| Does pyro create a persistent client/server connection? What
| happens if a pyro client goes down hard? Does it's process
| continue or is there a cleanup mechanism?
Hmmm. A little bit involved the answer to this one. In essence,
once you've got hold of another object via Pyro it's down to
the network to get the message through. If the other end goes
down, you can trap the Exceptions coming back and clean up
as you see fit. The Pyro plumbing does support an auto-reconnect
mechanism for Pyro objects. The details escape me now -- I've
never used it myself -- but I seem to remember that you restart
your object and its daemon (ie server bit) telling it to reconnect
as well as it can. There's no persistence involved (unless you've
implemented something yourself) so you'll have to clean up whatever
mess there was left over as you come back up.
Hope all that helps.
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
More information about the Python-list