[Twisted-Python] Re: writing back to the connection is blocking my code

coder_gus coder_gus at lavabit.com
Fri Mar 21 08:50:04 EDT 2008


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? 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. ?


Phil Mayers wrote:
> coder_gus wrote:
>> Well, by default the Nagle algorithm is turned off so it should 
>> transmit the data asap. I don't think it's OS dependent.
>
> It's only off if you've turned it off. It's on by default AFAIK on 
> most OSes.
>
> Anyway, Nagle is irrelevant - if the TCP window is closed i.e. you've 
> sent N bytes and the far end has not acked, and N == window, your TCP 
> stack WILL NOT (MUST NOT) send any more.
>
>>
>> Toby Dickenson wrote:
>>> coder_gus wrote:
>>>
>>>  
>>>> Ok, this link answered a few of my questions (stupid of me that I
>>>> haven't looked on that before I posted), but my question still stands:
>>>> how do I send data to a client whenever I want from wherever I want 
>>>> and
>>>> that data to be send as fast as possible,
>>>>     
>>>
>>> The code in the faq that glyph pointed you to will do what you want, 
>>> if I
>>> understand your requirements correctly. Heres the link again:
>>>
>>> http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#HowdoImakeinputononeconnectionresultinoutputonanother 
>>>
>>>
>>>  
>>>> without the code waiting for the reactor to answer to some events?
>>>>     
>>>
>>> Your transmission *might* have to wait if the operating system transmit
>>> buffers are already full, and, if so, the reactor is the mechanism 
>>> which
>>> means your new data can wait without blocking the whole process.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Twisted-Python mailing list
>>> Twisted-Python at twistedmatrix.com
>>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>>
>>> ____________________________________________________________________________________ 
>>>
>>> Save hundreds on an Unsecured Loan - Click here.
>>> http://ads.lavabit.com/fc/REAK6bkM9e5ejOJrLUP0P44A0oQrI53GoIDlgN8VVyT8BnEAxlYQBU/ 
>>>
>>> ____________________________________________________________________________________ 
>>>
>>>   
>>
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
> ____________________________________________________________________________________ 
>
> Handyman Franchises. Click Here.
> http://ads.lavabit.com/fc/REAK6bkONUs9yhym0lTTSbxUFXmZYqNkZwLDRJhQY0xBalLSyOwtqs/ 
>
> ____________________________________________________________________________________ 
>





More information about the Twisted-Python mailing list