[Twisted-Python] Guidance on Proxy-type Application

Jean-Paul Calderone exarkun at divmod.com
Thu May 28 15:45:46 EDT 2009


On Thu, 28 May 2009 15:22:20 -0400, Aaron Bush <asb.bush at gmail.com> wrote:
>Thanks John.
>
>Here is some sample code that is somewhat working for me right now.  Any and
>all comments are greatly appreciated.
>
> [snip]
> - I need to determine how to better handle the case where the connection
>made via ReconnectingClientFactory is dropped.  It does reconnect as the
>Factory should but the problem is that the Server portion is not cleanly
>shutdown so when the ChattyMCProtocol tries to listen it fails as the socket
>is already in use.  Any ideas how to signal to the server to shutdown?

reactor.listenTCP returns an IListeningPort provider.  This interface has
a stopListening method.  You probably just want to call this when your
client connection is lost.

Alternatively, just set up the listening port once, instead of once per
client connection, and re-use it across all of your client connections.

Jean-Paul




More information about the Twisted-Python mailing list