[Kamaelia] TCPClient: How to sense connection failure?

Michael Sparks ms at cerenity.org
Mon Jan 14 12:00:31 EST 2008


Bjoern Schliessmann wrote:

> Whoops, the TCP client does in fact quit if the server closes
> connection :) 

Great - so it wasn't a problem with the TCPClient after all :-)

> For some reason, my Listener doesn't quit. I thought 
> it's sufficient to exit the main method in some way to quit a
> component? That's what I do using "break" in the
> 'if self.dataReady("control")' part of main.

It is sufficient, and running with Kamaelia from /trunk, your listener does
indeed shutdown correctly - so it looks like it's a bug in that release of
Kamaelia.

That's my bad really because we haven't done a full release in quite some
time. 

Looking at the old code, it appears that in that code the TCPClient wasn't
forwarding shutdown messages correctly, so there *was* a bug, but there
doesn't seem to be now.

My suggestion for the moment would be to use the code on /trunk since this
is stable at present (development happens on branches rather than /trunk)
and that I really ought to sort out the next release - I really hadn't
realised just how long it had been since the last release!

steps:

~> svn co https://kamaelia.svn.sourceforge.net/svnroot/kamaelia/trunk
kamaelia-trunk
~> cd kamaelia-trunk
~/kamaelia-trunk> cd Code/Python/Axon
~/kamaelia-trunk/Code/Python/Axon> sudo python setup.py install
~/kamaelia-trunk/Code/Python/Axon> cd ../Kamaelia
~/kamaelia-trunk/Code/Python/Kamaelia> sudo python setup.py install

I've tested using this, and your code works as you'd expect.

Regards,


Michael.




More information about the Python-list mailing list