From 7ef95f62fe8317c807d0ec7f38feb462a931cb22 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 19 Apr 2021 15:14:44 +0100 Subject: [PATCH] change for udp implementation --- Controlled/controlled-keymouse.py | 8 ++++---- Controller/controller-screen.py | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Controlled/controlled-keymouse.py b/Controlled/controlled-keymouse.py index c085069..24203fc 100644 --- a/Controlled/controlled-keymouse.py +++ b/Controlled/controlled-keymouse.py @@ -23,12 +23,12 @@ s.bind((SERVER_HOST, SERVER_PORT)) # enabling our server to accept connections # 5 here is the number of unaccepted connections that # the system will allow before refusing new connections -s.listen(5) +# s.listen(5) print(f"[*] Listening as {SERVER_HOST}:{SERVER_PORT}") # accept connection if there is any -client_socket, address = s.accept() +# client_socket, address = s.accept() # if below code is executed, that means the sender is connected -print(f"[+] {address} is connected.") +# print(f"[+] {address} is connected.") def pressRrelease_char(char, which): @@ -39,7 +39,7 @@ def pressRrelease_char(char, which): while True: # read 1024 bytes from the socket (receive) - bytes_read = client_socket.recv(BUFFER_SIZE) + bytes_read = s.recv(BUFFER_SIZE) if not bytes_read: # nothing is received # file transmitting is done take another time diff --git a/Controller/controller-screen.py b/Controller/controller-screen.py index 6a061e1..1c0a55f 100644 --- a/Controller/controller-screen.py +++ b/Controller/controller-screen.py @@ -16,15 +16,15 @@ s.bind((SERVER_HOST, SERVER_PORT)) # enabling our server to accept connections # 5 here is the number of unaccepted connections that # the system will allow before refusing new connections -s.listen(5) +# s.listen(5) print(f"[*] Listening as {SERVER_HOST}:{SERVER_PORT}") # accept connection if there is any -client_socket, address = s.accept() +# client_socket, address = s.accept() # if below code is executed, that means the sender is connected -print(f"[+] {address} is connected.") +# print(f"[+] {address} is connected.") # receive the file infos # receive using client socket, not server socket -received = client_socket.recv(BUFFER_SIZE).decode() +received = s.recv(BUFFER_SIZE).decode() filename, filesize = received.split(SEPARATOR) # remove absolute path if there is #filename = os.path.basename(filename) @@ -37,7 +37,7 @@ filesize = int(filesize) while True: # read 1024 bytes from the socket (receive) - bytes_read = client_socket.recv(BUFFER_SIZE) + bytes_read = s.recv(BUFFER_SIZE) if not bytes_read: # nothing is received # file transmitting is done take another time