Skip to content

Commit e4304c2

Browse files
committed
Updated HW1
1 parent 3976d39 commit e4304c2

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

students/robert/Python 200/Session 1/echo_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ def client(msg, log_buffer=sys.stderr):
88
server_address = ('localhost', 10000)
99
# TODO: Replace the following line with your code which will instantiate
1010
# a TCP socket with IPv4 Addressing, call the socket you make 'sock'
11-
#sock = None
11+
# sock = None
1212
sock = socket.socket(
1313
socket.AF_INET,
1414
socket.SOCK_STREAM,
1515
socket.IPPROTO_IP)
16-
# print('connecting to {0} port {1}'.format(*server_address), file=log_buffer)
16+
print('connecting to {0} port {1}'.format(*server_address), file=log_buffer)
1717

1818
# TODO: connect your socket to the server here.
1919
sock.connect(('127.0.0.1', 10000))

students/robert/Python 200/Session 1/echo_server.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)