File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323#
2424def finger (host , args ):
2525 s = socket (AF_INET , SOCK_STREAM )
26- s .connect (host , FINGER_PORT )
26+ s .connect (( host , FINGER_PORT ) )
2727 s .send (args + '\n ' )
2828 while 1 :
2929 buf = s .recv (1024 )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def control(hostname):
4848 # Create control connection
4949 #
5050 s = socket (AF_INET , SOCK_STREAM )
51- s .connect (hostname , FTP_PORT )
51+ s .connect (( hostname , FTP_PORT ) )
5252 f = s .makefile ('r' ) # Reading the replies is easier from a file...
5353 #
5454 # Control loop
@@ -79,7 +79,7 @@ def newdataport(s, f):
7979 port = nextport + FTP_DATA_PORT
8080 nextport = (nextport + 1 ) % 16
8181 r = socket (AF_INET , SOCK_STREAM )
82- r .bind (gethostbyname (gethostname ()), port )
82+ r .bind (( gethostbyname (gethostname ()), port ) )
8383 r .listen (1 )
8484 sendportcmd (s , f , port )
8585 return r
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def main():
1919 else :
2020 port = PORT
2121 s = socket (AF_INET , SOCK_STREAM )
22- s .bind ('' , port )
22+ s .bind (( '' , port ) )
2323 s .listen (1 )
2424 while 1 :
2525 conn , (remotehost , remoteport ) = s .accept ()
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def main():
5151 s = socket (AF_INET , SOCK_STREAM )
5252 #
5353 try :
54- s .connect (host , port )
54+ s .connect (( host , port ) )
5555 except error , msg :
5656 sys .stderr .write ('connect failed: ' + `msg` + '\n ' )
5757 sys .exit (1 )
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def server():
4444 else :
4545 port = MY_PORT
4646 s = socket (AF_INET , SOCK_STREAM )
47- s .bind ('' , port )
47+ s .bind (( '' , port ) )
4848 s .listen (1 )
4949 print 'Server ready...'
5050 while 1 :
@@ -72,7 +72,7 @@ def client():
7272 t1 = time .time ()
7373 s = socket (AF_INET , SOCK_STREAM )
7474 t2 = time .time ()
75- s .connect (host , port )
75+ s .connect (( host , port ) )
7676 t3 = time .time ()
7777 i = 0
7878 while i < count :
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def server():
3333 else :
3434 port = ECHO_PORT
3535 s = socket (AF_INET , SOCK_DGRAM )
36- s .bind ('' , port )
36+ s .bind (( '' , port ) )
3737 print 'udp echo server ready'
3838 while 1 :
3939 data , addr = s .recvfrom (BUFSIZE )
@@ -50,7 +50,7 @@ def client():
5050 port = ECHO_PORT
5151 addr = host , port
5252 s = socket (AF_INET , SOCK_DGRAM )
53- s .bind ('' , 0 )
53+ s .bind (( '' , 0 ) )
5454 print 'udp echo client ready, reading stdin'
5555 while 1 :
5656 line = sys .stdin .readline ()
You can’t perform that action at this time.
0 commit comments