Popular recipes by anatoly techtonik http://code.activestate.com/recipes/users/4168147/2012-12-04T20:17:59-08:00ActiveState Code RecipesRead text data from the network port (Python)
2012-12-04T20:17:59-08:00anatoly techtonikhttp://code.activestate.com/recipes/users/4168147/http://code.activestate.com/recipes/578355-read-text-data-from-the-network-port/
<p style="color: grey">
Python
recipe 578355
by <a href="/recipes/users/4168147/">anatoly techtonik</a>
(<a href="/recipes/tags/network/">network</a>).
</p>
<p>Here is a way to wait for incoming text on some port and print it to the screen. This is the best technique I could come up with.</p>
Get full caller name (package.module.function) (Python)
2012-11-30T21:54:46-08:00anatoly techtonikhttp://code.activestate.com/recipes/users/4168147/http://code.activestate.com/recipes/578352-get-full-caller-name-packagemodulefunction/
<p style="color: grey">
Python
recipe 578352
by <a href="/recipes/users/4168147/">anatoly techtonik</a>
(<a href="/recipes/tags/caller/">caller</a>, <a href="/recipes/tags/debug/">debug</a>, <a href="/recipes/tags/logging/">logging</a>).
</p>
<p>This function allows to get fully qualified name of the calling function. I expected this field to be available from logging module, but it is not here <a href="http://docs.python.org/2/library/logging.html#logrecord-attributes" rel="nofollow">http://docs.python.org/2/library/logging.html#logrecord-attributes</a> It might be that it is too expensive for performance or just doesn't play well in some situations. I don't know. I use it solely when debugging and it is convenient.</p>
<p>Also here: <a href="https://gist.github.com/2151727" rel="nofollow">https://gist.github.com/2151727</a></p>
Wait for network service to appear (Python)
2009-02-20T14:04:11-08:00anatoly techtonikhttp://code.activestate.com/recipes/users/4168147/http://code.activestate.com/recipes/576655-wait-for-network-service-to-appear/
<p style="color: grey">
Python
recipe 576655
by <a href="/recipes/users/4168147/">anatoly techtonik</a>
(<a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/socket/">socket</a>).
Revision 2.
</p>
<p>This script allows you to wait until specified port is opened on remote server. This can be useful in automation jobs - restarting server, wake on lan etc. It can also be used for monitoring distant service/site.</p>
<p>The main problem that this script solves is that you need to handle two different timeouts when opening probing socket, and it is not described in python documentation. See <a href="http://bugs.python.org/issue5293" rel="nofollow">http://bugs.python.org/issue5293</a> for more information.</p>