Top-rated recipes tagged "asyncore" Code RecipesAsynchronous subprocess using asyncore (Python) 2013-01-21T19:51:00-08:00Glenn Eychaner <p style="color: grey"> Python recipe 576957 by <a href="/recipes/users/4172294/">Glenn Eychaner</a> (<a href="/recipes/tags/async/">async</a>, <a href="/recipes/tags/asynchronous/">asynchronous</a>, <a href="/recipes/tags/asyncore/">asyncore</a>, <a href="/recipes/tags/coroutine/">coroutine</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/ipc/">ipc</a>, <a href="/recipes/tags/subprocess/">subprocess</a>). Revision 21. </p> <p>A coroutine-based wrapper for subprocess.Popen that uses asyncore to communicate with child processes asynchronously. This allows subprocesses to be called from within socket servers or clients without needing a complicated event loop to check both. Uses <a href="">recipe 576965</a> to provide the asynchronous coroutine framework, <a href="">recipe 576967</a> to provide asynchronous pipes, and <a href="">recipe 577600</a> to provide multiple alarms.</p> asyncore scheduler (Python) 2011-07-25T23:42:21-07:00Giampaolo RodolĂ <p style="color: grey"> Python recipe 577808 by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a> (<a href="/recipes/tags/asynchronous/">asynchronous</a>, <a href="/recipes/tags/asyncore/">asyncore</a>, <a href="/recipes/tags/heapq/">heapq</a>, <a href="/recipes/tags/nonblocking/">nonblocking</a>, <a href="/recipes/tags/scheduler/">scheduler</a>, <a href="/recipes/tags/twisted/">twisted</a>). Revision 5. </p> <p>The thing I miss mostly in asyncore is a system for calling a function after a certain amount of time without blocking. This is crucial for simple tasks such as disconnecting a peer after a certain time of inactivity or more advanced use cases such as <a href="">bandwidth throttling</a>.</p> <p>This recipe was initially inspired by Twisted's internet.base.DelayedCall class:</p> <p><a href="" rel="nofollow"></a></p> <p>...then included into pyftpdlib:</p> <p><a href="" rel="nofollow"></a></p> <p>...and finally proposed for inclusion into asyncore:</p> <p><a href="" rel="nofollow"></a></p> Asynchronous pipe communication using asyncore (Python) 2013-10-29T16:48:22-07:00Glenn Eychaner <p style="color: grey"> Python recipe 576967 by <a href="/recipes/users/4172294/">Glenn Eychaner</a> (<a href="/recipes/tags/async/">async</a>, <a href="/recipes/tags/asyncore/">asyncore</a>, <a href="/recipes/tags/i_o/">i_o</a>, <a href="/recipes/tags/pipe/">pipe</a>). Revision 9. </p> <p>Extends file_dispatcher to provide extra functionality for reading from and writing to pipes. Uses the observer pattern (<a href="">recipe 576962</a>) to provide notification of new data and closed pipes.</p>