[Python-checkins] CVS: python/dist/src/Demo/sockets finger.py,1.4,1.5 ftp.py,1.4,1.5 rpythond.py,1.2,1.3 telnet.py,1.4,1.5 throughput.py,1.5,1.6 udpecho.py,1.4,1.5

Jeremy Hylton python-dev@python.org
Fri, 25 Aug 2000 08:38:44 -0700


Update of /cvsroot/python/python/dist/src/Demo/sockets
In directory slayer.i.sourceforge.net:/tmp/cvs-serv18640

Modified Files:
	finger.py ftp.py rpythond.py telnet.py throughput.py 
	udpecho.py 
Log Message:
update demo scripts to use addr tuples for bind and connect
closes bug #111928


Index: finger.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/sockets/finger.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** finger.py	1996/11/27 19:50:39	1.4
--- finger.py	2000/08/25 15:38:41	1.5
***************
*** 24,28 ****
  def finger(host, args):
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.connect(host, FINGER_PORT)
  	s.send(args + '\n')
  	while 1:
--- 24,28 ----
  def finger(host, args):
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.connect((host, FINGER_PORT))
  	s.send(args + '\n')
  	while 1:

Index: ftp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/sockets/ftp.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** ftp.py	1995/01/12 12:42:09	1.4
--- ftp.py	2000/08/25 15:38:41	1.5
***************
*** 49,53 ****
  	#
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.connect(hostname, FTP_PORT)
  	f = s.makefile('r') # Reading the replies is easier from a file...
  	#
--- 49,53 ----
  	#
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.connect((hostname, FTP_PORT))
  	f = s.makefile('r') # Reading the replies is easier from a file...
  	#
***************
*** 80,84 ****
  	nextport = (nextport+1) % 16
  	r = socket(AF_INET, SOCK_STREAM)
! 	r.bind(gethostbyname(gethostname()), port)
  	r.listen(1)
  	sendportcmd(s, f, port)
--- 80,84 ----
  	nextport = (nextport+1) % 16
  	r = socket(AF_INET, SOCK_STREAM)
! 	r.bind((gethostbyname(gethostname()), port))
  	r.listen(1)
  	sendportcmd(s, f, port)

Index: rpythond.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/sockets/rpythond.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** rpythond.py	1996/11/27 19:50:44	1.2
--- rpythond.py	2000/08/25 15:38:41	1.3
***************
*** 20,24 ****
  		port = PORT
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.bind('', port)
  	s.listen(1)
  	while 1:
--- 20,24 ----
  		port = PORT
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.bind(('', port))
  	s.listen(1)
  	while 1:

Index: telnet.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/sockets/telnet.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** telnet.py	1996/11/27 19:50:46	1.4
--- telnet.py	2000/08/25 15:38:41	1.5
***************
*** 52,56 ****
  	#
  	try:
! 		s.connect(host, port)
  	except error, msg:
  		sys.stderr.write('connect failed: ' + `msg` + '\n')
--- 52,56 ----
  	#
  	try:
! 		s.connect((host, port))
  	except error, msg:
  		sys.stderr.write('connect failed: ' + `msg` + '\n')

Index: throughput.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/sockets/throughput.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** throughput.py	1996/11/27 19:50:47	1.5
--- throughput.py	2000/08/25 15:38:41	1.6
***************
*** 45,49 ****
  		port = MY_PORT
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.bind('', port)
  	s.listen(1)
  	print 'Server ready...'
--- 45,49 ----
  		port = MY_PORT
  	s = socket(AF_INET, SOCK_STREAM)
! 	s.bind(('', port))
  	s.listen(1)
  	print 'Server ready...'
***************
*** 73,77 ****
  	s = socket(AF_INET, SOCK_STREAM)
  	t2 = time.time()
! 	s.connect(host, port)
  	t3 = time.time()
  	i = 0
--- 73,77 ----
  	s = socket(AF_INET, SOCK_STREAM)
  	t2 = time.time()
! 	s.connect((host, port))
  	t3 = time.time()
  	i = 0

Index: udpecho.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Demo/sockets/udpecho.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** udpecho.py	1996/11/27 19:50:49	1.4
--- udpecho.py	2000/08/25 15:38:41	1.5
***************
*** 34,38 ****
  		port = ECHO_PORT
  	s = socket(AF_INET, SOCK_DGRAM)
! 	s.bind('', port)
  	print 'udp echo server ready'
  	while 1:
--- 34,38 ----
  		port = ECHO_PORT
  	s = socket(AF_INET, SOCK_DGRAM)
! 	s.bind(('', port))
  	print 'udp echo server ready'
  	while 1:
***************
*** 51,55 ****
  	addr = host, port
  	s = socket(AF_INET, SOCK_DGRAM)
! 	s.bind('', 0)
  	print 'udp echo client ready, reading stdin'
  	while 1:
--- 51,55 ----
  	addr = host, port
  	s = socket(AF_INET, SOCK_DGRAM)
! 	s.bind(('', 0))
  	print 'udp echo client ready, reading stdin'
  	while 1: