Popular recipes tagged "networking" but not "client_server"http://code.activestate.com/recipes/tags/networking-client_server/2017-03-05T11:00:27-08:00ActiveState Code RecipesServer supporting IPv4 and IPv6 (Python)
2017-03-05T11:00:27-08:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/578504-server-supporting-ipv4-and-ipv6/
<p style="color: grey">
Python
recipe 578504
by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a>
(<a href="/recipes/tags/dualstack/">dualstack</a>, <a href="/recipes/tags/ipv4/">ipv4</a>, <a href="/recipes/tags/ipv6/">ipv6</a>, <a href="/recipes/tags/ipv6_v6only/">ipv6_v6only</a>, <a href="/recipes/tags/networking/">networking</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/socket/">socket</a>).
Revision 13.
</p>
<p>Utility functions to create a single server socket which able to listen on both IPv4 and IPv6. Inspired by:
<a href="http://bugs.python.org/issue17561" rel="nofollow">http://bugs.python.org/issue17561</a></p>
<p>Expected usage:</p>
<pre class="prettyprint"><code>>>> sock = create_server_sock(("", 8000))
>>> if not has_dual_stack(sock):
... sock.close()
... sock = MultipleSocketsListener([("0.0.0.0", 8000), ("::", 8000)])
>>>
</code></pre>
<p>From here on you have a socket which listens on port 8000, all interfaces, serving both IPv4 and IPv6. You can start accepting new connections as usual:</p>
<pre class="prettyprint"><code>>>> while True:
... conn, addr = sock.accept()
... # handle new connection
</code></pre>
<p>Supports UNIX, Windows, non-blocking sockets and socket timeouts.
Works with Python >= 2.6 and 3.X.</p>
Get MAC address of current interface in one line of code (Python)
2012-10-01T17:16:27-07:00Leonid Vasilyevhttp://code.activestate.com/recipes/users/4183776/http://code.activestate.com/recipes/578277-get-mac-address-of-current-interface-in-one-line-o/
<p style="color: grey">
Python
recipe 578277
by <a href="/recipes/users/4183776/">Leonid Vasilyev</a>
(<a href="/recipes/tags/networking/">networking</a>, <a href="/recipes/tags/oneliner/">oneliner</a>).
Revision 2.
</p>
<p>uuid.getnode represents current mac address as an integer,
this one-liner formats this number in a standard mac adress form (i.e. bytes splitted by :)</p>
EAP-MD5 802.1X Supplicant (Python)
2010-12-29T22:15:14-08:00Andrew Grigorevhttp://code.activestate.com/recipes/users/4172098/http://code.activestate.com/recipes/577523-eap-md5-8021x-supplicant/
<p style="color: grey">
Python
recipe 577523
by <a href="/recipes/users/4172098/">Andrew Grigorev</a>
(<a href="/recipes/tags/authentication/">authentication</a>, <a href="/recipes/tags/eap/">eap</a>, <a href="/recipes/tags/md5/">md5</a>, <a href="/recipes/tags/networking/">networking</a>).
</p>
<p>802.1X EAP protocol supplicant (see RFC3748), supporting only MD5-Challenge authentication type. Linux only.</p>
receive UDP broadcasts (Python)
2010-06-30T16:46:16-07:00matt studieyhttp://code.activestate.com/recipes/users/4174312/http://code.activestate.com/recipes/577278-receive-udp-broadcasts/
<p style="color: grey">
Python
recipe 577278
by <a href="/recipes/users/4174312/">matt studiey</a>
(<a href="/recipes/tags/broadcast/">broadcast</a>, <a href="/recipes/tags/networking/">networking</a>, <a href="/recipes/tags/udp/">udp</a>).
</p>
<p>simplest implementation I could achieve</p>