]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
update demo scripts to use addr tuples for bind and connect
authorJeremy Hylton <jeremy@alum.mit.edu>
Fri, 25 Aug 2000 15:38:41 +0000 (15:38 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Fri, 25 Aug 2000 15:38:41 +0000 (15:38 +0000)
closes bug #111928

Demo/sockets/finger.py
Demo/sockets/ftp.py
Demo/sockets/rpythond.py
Demo/sockets/telnet.py
Demo/sockets/throughput.py
Demo/sockets/udpecho.py

index b941d0e2c4d586864fd8b910fb51f660195dc2ed..0c2baed0b4683d8bb90ed7dcebab89c38a2ae4e3 100755 (executable)
@@ -23,7 +23,7 @@ FINGER_PORT = 79
 #
 def finger(host, args):
        s = socket(AF_INET, SOCK_STREAM)
-       s.connect(host, FINGER_PORT)
+       s.connect((host, FINGER_PORT))
        s.send(args + '\n')
        while 1:
                buf = s.recv(1024)
index 2d492398c7260741cd2a0a6b178f76de0193fec7..8260c52f9c5d5f941b3f607151170832eb7ce4c8 100755 (executable)
@@ -48,7 +48,7 @@ def control(hostname):
        # Create control connection
        #
        s = socket(AF_INET, SOCK_STREAM)
-       s.connect(hostname, FTP_PORT)
+       s.connect((hostname, FTP_PORT))
        f = s.makefile('r') # Reading the replies is easier from a file...
        #
        # Control loop
@@ -79,7 +79,7 @@ def newdataport(s, f):
        port = nextport + FTP_DATA_PORT
        nextport = (nextport+1) % 16
        r = socket(AF_INET, SOCK_STREAM)
-       r.bind(gethostbyname(gethostname()), port)
+       r.bind((gethostbyname(gethostname()), port))
        r.listen(1)
        sendportcmd(s, f, port)
        return r
index e8cdaa950141a169854f032752211ace3a26340f..1109a99e182b55db3981c5d36aaa6dbffb772ad6 100755 (executable)
@@ -19,7 +19,7 @@ def main():
        else:
                port = PORT
        s = socket(AF_INET, SOCK_STREAM)
-       s.bind('', port)
+       s.bind(('', port))
        s.listen(1)
        while 1:
                conn, (remotehost, remoteport) = s.accept()
index e83ce55d680f45178568fdae673a6e5267013a14..ee7c43b87423084fe8d919a2af105976887de552 100755 (executable)
@@ -51,7 +51,7 @@ def main():
        s = socket(AF_INET, SOCK_STREAM)
        #
        try:
-               s.connect(host, port)
+               s.connect((host, port))
        except error, msg:
                sys.stderr.write('connect failed: ' + `msg` + '\n')
                sys.exit(1)
index 58975bf51d5a21699d23968986d608d09508c6aa..fa250e7755ee32fbd659f0ea5c22ed992a8c9ef0 100755 (executable)
@@ -44,7 +44,7 @@ def server():
        else:
                port = MY_PORT
        s = socket(AF_INET, SOCK_STREAM)
-       s.bind('', port)
+       s.bind(('', port))
        s.listen(1)
        print 'Server ready...'
        while 1:
@@ -72,7 +72,7 @@ def client():
        t1 = time.time()
        s = socket(AF_INET, SOCK_STREAM)
        t2 = time.time()
-       s.connect(host, port)
+       s.connect((host, port))
        t3 = time.time()
        i = 0
        while i < count:
index 8fce547f56a516cc419c71918b558e82079bec1a..4410165e3a3ddf937b8dce10bff43401ab834d0f 100755 (executable)
@@ -33,7 +33,7 @@ def server():
        else:
                port = ECHO_PORT
        s = socket(AF_INET, SOCK_DGRAM)
-       s.bind('', port)
+       s.bind(('', port))
        print 'udp echo server ready'
        while 1:
                data, addr = s.recvfrom(BUFSIZE)
@@ -50,7 +50,7 @@ def client():
                port = ECHO_PORT
        addr = host, port
        s = socket(AF_INET, SOCK_DGRAM)
-       s.bind('', 0)
+       s.bind(('', 0))
        print 'udp echo client ready, reading stdin'
        while 1:
                line = sys.stdin.readline()