Message3261

Author billiejoex
Recipients billiejoex
Date 2008-06-09.13:22:19
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1213017745.11.0.225579830515.issue1051@psf.upfronthosting.co.za>
In-reply-to
Content
It is often needed to build clients/servers that support both IPv4 and IPv6.
Example:

# Echo client program
import socket
import sys

HOST = 'daring.cwi.nl'    # The remote host
PORT = 50007              # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM):
    af, socktype, proto, canonname, sa = res
    try:
     s = socket.socket(af, socktype, proto)
    except socket.error, msg:
     s = None
     continue
    try:
     s.connect(sa)
    except socket.error, msg:
     s.close()
     s = None
     continue
    break
History
Date User Action Args
2008-09-12 00:32:30nrileysetspambayes_score: 0.195445 -> 0.0
2008-06-09 13:22:26billiejoexsetspambayes_score: 0.195445 -> 0.195445
recipients: + billiejoex
2008-06-09 13:22:25billiejoexsetspambayes_score: 0.195445 -> 0.195445
messageid: <1213017745.11.0.225579830515.issue1051@psf.upfronthosting.co.za>
2008-06-09 13:22:24billiejoexlinkissue1051 messages
2008-06-09 13:22:24billiejoexcreate