<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 12, 2013, at 3:15 AM, A Desai &lt;<a href="mailto:ardesai@yahoo.com">ardesai@yahoo.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div style="background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: static; z-index: auto;"><div>Scenario:&nbsp; TCP Receive Buffer on twisted HTTP server using the twisted application framework.&nbsp; And its behavior when set up as producer/consumer.<br></div><div style="font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;"><br></div><div style="font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">(1) Would like to set the receive buffer size on socket.&nbsp; One way to do this would be to create a derived class of TCPServer (or SSLServer) and set the buffer size and use derived class server in the .tac file.&nbsp; Would like to know if there is any sample code for such usage?&nbsp; For example, in which method of the derived class would one set the receive buffer size?</div></div></div></blockquote><div><br></div><div>You don't need to subclass these classes; and in any event, it wouldn't help, TCPServer and SSLServer don't have connections of their own, they're services that hold <i>listening</i> sockets, not connected sockets. &nbsp;If you want to set an option unsupported by Twisted, "transport.getHandle()" will give you the Python socket object (on those reactors which use socket objects internally, which is most of them). &nbsp;You can just set SO_RCVBUF on that socket from your Protocol class.</div><div><br></div><div>Also, this ticket may be of interest to you: &lt;<a href="https://twistedmatrix.com/trac/ticket/4089">https://twistedmatrix.com/trac/ticket/4089</a>&gt;. &nbsp;Tuning send and receive buffers <i>should</i>&nbsp;be more explicitly supported by Twisted.</div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div style="background-color: rgb(255, 255, 255); font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; position: relative; z-index: 0;"><div style="font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">(2) When an incoming http POST request is acting as a producer of data, which is tied to a consumer resource (some other connection), how can I control the incoming tcp window size, if the consumer has paused consuming?&nbsp; I presume the incoming network data will keep piling up in the 'huge' tcp buffer eventually advertising a 'tcp zero window' to the network peer of the data producer, AND the server ends up using up a large amount of memory for the paused connection.&nbsp; Is there an alternative?&nbsp; I realize that the TCP protocol inhibits 'reducing of an already advertised receive window', but I am wondering if pauseProducing() on an http channel could do something to at least prevent the tcp window size from increasing any further?<br></div></div></div></blockquote><br></div><div>I don't know that much about window scaling, but won't the fact that the application isn't receiving any data from the kernel automatically prevent the window from scaling any bigger?</div><div><br></div><div>-glyph</div><div><br></div></body></html>