[Twisted-Python] [newbie] server script with client functionality
evert.rol at gmail.com
Mon Oct 15 15:39:26 EDT 2007
I'm trying to write a server script that can pass the received data
on (acting as a client) to a next server.
Say, server A receives data from client B, and then acts as client A
(while keeping in contact with client B) for server C.
I'm using it to pass data through an extra machine before reaching
the actual machine, where the extra machine serves as a security
measure (eg, if that gets hacked, that won't bring too may other
I'm new to Twisted, so I'm not sure where to find information on
this. I've been looking at creating a client at the moment that the
server receives data (in the dataReceived() method), but then I get
two factory.run() methods, and would also need to find a way to stop
the client; that doesn't seem to be correct. Or perhaps using
threads, but then I don't know how to pass the data from the server
Best to me would to have both connections active, each on their own
port, and when data is received, 'something' in the client part gets
called that sends these data on.
Alternatively, I could simply call an external program with the data
as arguments from the server script, but I'd like a all-in-one
solution if possible. Or perhaps I'm looking at this the wrong way?
(Although I'd prefer not to try and turn 'server C' into 'client C'.)
Any suggestions or pointers?
Thanks in advance,
More information about the Twisted-Python