@@ -9,12 +9,11 @@ def server(log_buffer=sys.stderr):
99 address = ('127.0.0.1' , 10000 )
1010 # TODO: Replace the following line with your code which will instantiate
1111 # a TCP socket with IPv4 Addressing, call the socket you make 'sock'
12- # sock = None
12+ # sock = None
1313 sock = socket .socket (
14- socket .AF_INET ,
15- socket .SOCK_STREAM ,
16- socket .IPPROTO_TCP
17- )
14+ socket .AF_INET ,
15+ socket .SOCK_STREAM ,
16+ socket .IPPROTO_TCP )
1817 # TODO: You may find that if you repeatedly run the server script it fails,
1918 # claiming that the port is already used. You can set an option on
2019 # your socket that will fix this problem. We DID NOT talk about this
@@ -42,7 +41,7 @@ def server(log_buffer=sys.stderr):
4241 # the client so we can report it below. Replace the
4342 # following line with your code. It is only here to prevent
4443 # syntax errors
45- # addr = ('bar', 'baz')
44+ # addr = ('bar', 'baz')
4645 conn , addr = sock .accept ()
4746 try :
4847 # print('connection - {0}:{1}'.format(*addr), file=log_buffer)
@@ -56,8 +55,8 @@ def server(log_buffer=sys.stderr):
5655 # following line with your code. It's only here as
5756 # a placeholder to prevent an error in string
5857 # formatting
59- # data = b''
60- # print('received "{0}"'.format(data.decode('utf8')))
58+ # data = b''
59+ # print('received "{0}"'.format(data.decode('utf8')))
6160 buffer_size = 16
6261 data = conn .recv (buffer_size )
6362 print ('received "{0}"' .format (data .decode ('utf8' )))
@@ -86,7 +85,7 @@ def server(log_buffer=sys.stderr):
8685 # close the server socket and exit from the server function.
8786 # Replace the call to `pass` below, which is only there to
8887 # prevent syntax problems
89- # pass
88+ # pass
9089 sock .close ()
9190 # print('quitting echo server', file=log_buffer)
9291
0 commit comments