[Twisted-Python] simple tcpgate in Twisted

Jean-Paul Calderone exarkun at divmod.com
Mon Feb 11 08:43:36 EST 2008


On Sun, 10 Feb 2008 21:48:16 -0600, Andy Leszczynski <leszczynscy at yahoo.com> wrote:
>Jean-Paul Calderone wrote:
>>On Wed, 06 Feb 2008 09:03:11 -0600, Andy Leszczynski 
>><leszczynscy at yahoo.com> wrote:
>>>Hi,
>>>
>>>I need to write a simple TCP/IP gate which would accept connections, 
>>>reconnect to arbitrary (address,port), retransmit all data from both ends, 
>>>and finally closed the connection upon either end closing it too.
>>
>>twisted.protocols.portforward probably does something quite similar to what
>>you want.
>thx a lot for a suggestion.  That self.transport.pause/resumeProducing
>is great.
>
>The only thing I am not sure how it works is how ProxyServer handles the
>closing connection. from its external client. Is it just done in base
>classes?

Both ProxyClient and ProxyServer subclass Proxy.  Proxy implements
connectionLost to close the other connection.  So, yes.

Jean-Paul




More information about the Twisted-Python mailing list