Python SocketServer with IPv6
chinthakawk at gmail.com
Thu Apr 30 11:52:55 CEST 2009
On Apr 30, 1:02 pm, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> > I am working on a overlay network implementation with python. I need
> > to use both IPv4 and IPv6 at each node. Python socketserver is being
> > used for this task. can anybody pls suggest me how to input an IPv6
> > address to the socketserver.
> I'm not quite sure I understand the question, so here is a complete
> import SocketServer, socket
> class SimpleHandler(SocketServer.BaseRequestHandler):
> def handle(self):
> print "Received connection from", self.client_address
> class V6Server(SocketServer.TCPServer):
> address_family = socket.AF_INET6
> s = V6Server(("::",4444), SimpleHandler)
> Hope this helps,
> P.S. I recommend to dual-stack sockets, i.e. to turn off the
> IPV6_V6ONLY socket option, and to bind to both v4 and v6 interfaces.
Thank you very much Martin,
that was the one I exactly wanted to know. I was searching how I can
Thanks once again.
More information about the Python-list