[Python-bugs-list] [Bug #111928] obsolete use of socket.connect()

noreply@sourceforge.net noreply@sourceforge.net
Fri, 25 Aug 2000 08:39:14 -0700


Bug #111928, was updated on 2000-Aug-14 19:09
Here is a current snapshot of the bug.

Project: Python
Category: demos and tools
Status: Closed
Resolution: Fixed
Bug Group: None
Priority: 5
Summary: obsolete use of socket.connect()

Details: in 1.6b1 tree under "Demo/sockets", there are obsolete use of
socket.connect() still present.

Index: Demo/sockets/finger.py
===================================================================
RCS file: /cvsroot/apps/python/Demo/sockets/finger.py,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 finger.py
--- Demo/sockets/finger.py	1999/04/13 10:01:42	1.1.1.1
+++ Demo/sockets/finger.py	2000/08/15 02:08:12
@@ -23,7 +23,7 @@
 #
 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: Demo/sockets/ftp.py
===================================================================
RCS file: /cvsroot/apps/python/Demo/sockets/ftp.py,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ftp.py
--- Demo/sockets/ftp.py	1999/04/13 10:01:42	1.1.1.1
+++ Demo/sockets/ftp.py	2000/08/15 02:08:12
@@ -48,7 +48,7 @@
 	# 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 @@
 	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: Demo/sockets/telnet.py
===================================================================
RCS file: /cvsroot/apps/python/Demo/sockets/telnet.py,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 telnet.py
--- Demo/sockets/telnet.py	1999/04/13 10:01:42	1.1.1.1
+++ Demo/sockets/telnet.py	2000/08/15 02:08:12
@@ -51,7 +51,7 @@
 	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: Demo/sockets/throughput.py
===================================================================
RCS file: /cvsroot/apps/python/Demo/sockets/throughput.py,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 throughput.py
--- Demo/sockets/throughput.py	1999/04/13 10:01:42	1.1.1.1
+++ Demo/sockets/throughput.py	2000/08/15 02:08:12
@@ -72,7 +72,7 @@
 	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:


Follow-Ups:

Date: 2000-Aug-25 08:39
By: jhylton

Comment:
There were a few more calls to bind that also needed to be fixed.

-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=111928&group_id=5470