python - How do I detect a lost client connection in a server that inherits from pb.Root? -


For example, I have a customer who connects to the server with the following:

  Category MyClientFactory (pb.PBClientFactory): def __init __ (self): pb.PBClientFactory .__ init __ (self) self.ipaddress = created a DIF client connection (auto, broker): log.msg (' Start to connect '. PBClientFactory.clientConnectionMade (self, broker) def build protocol (auto, endorse): log.msg ('% s' connect to% addr) Return pb.PBClientFactory.buildProtocol (self, ADR) DIF client ClientFactory.clientConnectionLost (Self, Connector, Reason) DIF Client Connecting Fail (Self, Connector, Reason): log. ClientFactory ClientConnectionLost (auto, connector, reason)  

Therefore the client can automatically detect that the connection is lost .

How do I get the same behavior from the server, the customer Programming should go down, for example crashing?

I currently have a DeadReferenceError, (by recreating via a list of potentially connected customers), but this is a non-incident driven route - and it's obviously too late.

Any thoughts are welcome.

Thanks in advance. / P>

Ben

You can enter a callback if the connection is lost, two for it There are APIs, a broker.Notiffion disconnected , the second is remote reference.NotiffxDennect . They do the same thing, but can be more convenient to reach one or the other depending on the details of your application.

I'm not sure that you will use it Guarantee that you will never find anytime (for example, I'm not sure if any Remote_Foo If the method applies, what happens, you return, the connection is lost, and then deferred fire), but you can minimize the probability in the least common case (i.e., you always have You should be able to avoid from deadReferenceError to callRemote if you want to Minister also callRemote after Adisucnaandisknekt call back do not use your function.).


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -