[Twisted-Python] protocol.Protocol and transport.write
Michele Petrazzo
michele.petrazzo at unipex.it
Tue Jul 19 06:02:32 MDT 2005
I have a very simple application that try to open a connection on a port
on the local computer and if it has no program listening, it execute a
program file, else if it find a answer program, it send a string ( about
50/80 characters ).
After the upgrade to 2.0.x, it don't want to work well, because if it
has no response, it open the program correctly, but if it has response,
it send the message, but the message don't arrive to the listener.
After some tries, I see that into my code, I call reactor.stop before, I
think, reactor has ended to send my message. I resolve this with a
simple code: reactor.callLater(1, reactor.stop).
My question is: when I call reactor.stop, it close all, also if there
are some communication in progress? Is there another method to close the
communication (and in my case the program) when I'm sure that all the
works are ended?
Thanks,
Michele
My code:
class ConneExist(protocol.Protocol):
#The server is listening
def connectionMade(self):
self.transport.write(file_name_path)
out()
def out():
# reactor.stop() <- here is a problem
reactor.callLater(1, reactor.stop)
More information about the Twisted-Python
mailing list