summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-08-25 15:38:41 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-08-25 15:38:41 (GMT)
commita8d30d5d667b32b1b296c0926a0e80709bd6fab3 (patch)
treea68f728c1c466ea08e04c3dcf08e2cafa2746132 /Demo
parent239f836c10425bb2514284dd4eb4fc63b206b587 (diff)
downloadcpython-a8d30d5d667b32b1b296c0926a0e80709bd6fab3.zip
cpython-a8d30d5d667b32b1b296c0926a0e80709bd6fab3.tar.gz
cpython-a8d30d5d667b32b1b296c0926a0e80709bd6fab3.tar.bz2
update demo scripts to use addr tuples for bind and connect
closes bug #111928
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/sockets/finger.py2
-rwxr-xr-xDemo/sockets/ftp.py4
-rwxr-xr-xDemo/sockets/rpythond.py2
-rwxr-xr-xDemo/sockets/telnet.py2
-rwxr-xr-xDemo/sockets/throughput.py4
-rwxr-xr-xDemo/sockets/udpecho.py4
6 files changed, 9 insertions, 9 deletions
diff --git a/Demo/sockets/finger.py b/Demo/sockets/finger.py
index b941d0e..0c2baed 100755
--- a/Demo/sockets/finger.py
+++ b/Demo/sockets/finger.py
@@ -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)
diff --git a/Demo/sockets/ftp.py b/Demo/sockets/ftp.py
index 2d49239..8260c52 100755
--- a/Demo/sockets/ftp.py
+++ b/Demo/sockets/ftp.py
@@ -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
diff --git a/Demo/sockets/rpythond.py b/Demo/sockets/rpythond.py
index e8cdaa9..1109a99 100755
--- a/Demo/sockets/rpythond.py
+++ b/Demo/sockets/rpythond.py
@@ -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()
diff --git a/Demo/sockets/telnet.py b/Demo/sockets/telnet.py
index e83ce55..ee7c43b 100755
--- a/Demo/sockets/telnet.py
+++ b/Demo/sockets/telnet.py
@@ -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)
diff --git a/Demo/sockets/throughput.py b/Demo/sockets/throughput.py
index 58975bf..fa250e7 100755
--- a/Demo/sockets/throughput.py
+++ b/Demo/sockets/throughput.py
@@ -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:
diff --git a/Demo/sockets/udpecho.py b/Demo/sockets/udpecho.py
index 8fce547..4410165 100755
--- a/Demo/sockets/udpecho.py
+++ b/Demo/sockets/udpecho.py
@@ -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()