@@ -9,7 +9,7 @@ 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 (
1414 socket .AF_INET ,
1515 socket .SOCK_STREAM ,
@@ -41,11 +41,10 @@ def server(log_buffer=sys.stderr):
4141 # the client so we can report it below. Replace the
4242 # following line with your code. It is only here to prevent
4343 # syntax errors
44- #addr = ('bar', 'baz')
44+ # addr = ('bar', 'baz')
4545 conn , addr = sock .accept ()
4646 try :
47- # print('connection - {0}:{1}'.format(*addr), file=log_buffer)
48-
47+ print ('connection - {0}:{1}' .format (* addr ), file = log_buffer )
4948 # the inner loop will receive messages sent by the client in
5049 # buffers. When a complete message has been received, the
5150 # loop will exit
@@ -55,16 +54,16 @@ def server(log_buffer=sys.stderr):
5554 # following line with your code. It's only here as
5655 # a placeholder to prevent an error in string
5756 # formatting
58- #data = b''
59- #print('received "{0}"'.format(data.decode('utf8')))
57+ # data = b''
58+ # print('received "{0}"'.format(data.decode('utf8')))
6059 buffer_size = 16
6160 data = conn .recv (buffer_size )
6261 print ('received "{0}"' .format (data .decode ('utf8' )))
6362 # TODO: Send the data you received back to the client, log
6463 # the fact using the print statement here. It will help in
6564 # debugging problems.
6665 conn .sendall (data )
67- # .encode('utf8'))
66+ # .encode('utf8'))
6867 print ('sent "{0}"' .format (data .decode ('utf8' )))
6968 # TODO: Check here to see if the message you've received is
7069 # complete. If it is, break out of this inner loop.
0 commit comments