Simon Pickles wrote:
Twisted is event driven.
So how do I send Data through a client? All the example demonstrate is how to receive events.
I suppose what I am asking is how do I refer to a client protocol from another class?
loop = = gatewayClient().start()
opens a reconnectingClientFactory, which opens a client protocol. How do i make that client protocol global enough to use from anywhere in my app? you "import MyFactory from mymodule" and use it as shown in example. You can do that anywhere in your app.
The ironic thing is, its easy with sockets :) I'd say the ironic thing is that sockets are so often used in a different way, imposing lots of unnecessary problems (apart from the fact that this is a rtfm question) :). What twisted gives you for free is a rock-stable way to do all networking asynchronous, which is no
Here is just one of the examples available, it's actually googles first hit for "twisted client example": http://twistedmatrix.com/projects/core/documentation/howto/tutorial/client.h... The function "finger" shows what is needed to start up a client. trivial task to achieve using sockets (i.e. writing a twisted equivalent from scratch). When you get used to it, it won't be harder to do simple things, and way easier to do complex things. It's certainly worth the effort. Johann