msg_client/msg_server: encode bytes before sending them

This commit is contained in:
Quentin De Coninck 2017-01-09 16:10:45 +01:00
parent 083b1b9032
commit b34c31507f
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ try:
time.sleep(5.0) time.sleep(5.0)
request = string_generator(size=MSG_SIZE, chars=string.digits) request = string_generator(size=MSG_SIZE, chars=string.digits)
start_time = datetime.datetime.now() start_time = datetime.datetime.now()
sock.sendall(request).encode(ENCODING) sock.sendall(request.encode(ENCODING))
buffer_data = "" buffer_data = ""
while len(buffer_data) < MSG_SIZE: while len(buffer_data) < MSG_SIZE:

View File

@ -50,7 +50,7 @@ class HandleClientConnectionThread(threading.Thread):
time.sleep(5.0) time.sleep(5.0)
response = string_generator(size=self.msg_size, chars=string.digits) response = string_generator(size=self.msg_size, chars=string.digits)
start_time = datetime.datetime.now() start_time = datetime.datetime.now()
self.connection.sendall(response).encode(ENCODING) self.connection.sendall(response.encode(ENCODING))
buffer_data = "" buffer_data = ""
elif len(buffer_data) > self.msg_size: elif len(buffer_data) > self.msg_size: