Skip to content

Commit 3976d39

Browse files
committed
Updated HW1
1 parent 8b73607 commit 3976d39

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ 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(
13-
socket.AF_INET,
14-
socket.SOCK_STREAM,
15-
socket.IPPROTO_IP
16-
)
13+
socket.AF_INET,
14+
socket.SOCK_STREAM,
15+
socket.IPPROTO_IP)
1716
# print('connecting to {0} port {1}'.format(*server_address), file=log_buffer)
1817

1918
# TODO: connect your socket to the server here.

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

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

Comments
 (0)