client: fixed GET

This commit is contained in:
2021-03-20 21:45:28 +01:00
parent 797cdb0c0e
commit fa8d08d63d
5 changed files with 341 additions and 142 deletions

View File

@@ -3,6 +3,7 @@
import socket
# socket heeft een listening and accept method
import time
SERVER = "127.0.0.1" #dynamisch fixen in project
PORT = 5055
@@ -26,8 +27,11 @@ def start():
while connected: # while client is connected, we want to recieve messages
msg = conn.recv(HEADER).decode(FORMAT).rstrip() # Argument is maximum size of msg (in project look into details of accp), decode is for converting bytes to strings, rstrip is for stripping messages for special hidden characters
print("message: ", msg)
if msg == DISCONNECT_MESSAGE:
connected = False
for i in range(0,10):
conn.send(b"test")
time.sleep(1)
break
print("close connection ", addr[0], " disconnected.")
conn.close()