[Twisted-Python] Re: writing back to the connection is blocking my code
therve at free.fr
Fri Mar 21 09:25:16 EDT 2008
Quoting coder_gus <coder_gus at lavabit.com>:
> Agreed, I was talking about transport.tcpKeepAlive(). The thing I am
> asking (and call me stupid, but I am trying to figure it out for days
> now and no one seems to answer my question or is it me too stupid that
> can see the answer in front of my eyes) is how do I send data to
> clients that are connected to the twisted server waiting for data to be
> processed, without sending to the server any data or causing any event
> to the server?
This is where you are confused I think. There is no way to send data
to clients if you don't have *any* events on the server. Because how
would you now to send data if you don't have something telling you to
do so? You should have a time event, or a network event from another
client, or a GUI input, or whatever.
> In the link you guys showed me it's true that the data
> gets back to the clients, but only when the server receives other data,
> that is in the dataReceived method. How can I send it back to them
> (having a reference to each client's protocol class) without receiving
> data, client connecting etc. ?
It's not totally clear to understand what you're trying to achieve, so
maybe you want to explain more clearly your problem. I suspect you
want to use reactor.callLater, to generate a time event.
More information about the Twisted-Python