Created
June 20, 2020 03:27
-
-
Save NimishMishra/c2f00a495f3205b55c10cfee977a2bb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def file_handler(target_client, command): | |
target_client.send(bytes(command, 'utf-8')) | |
acknowledgement = target_client.recv(BUFFER_SIZE) | |
if(acknowledgement == b'ACK'): | |
pass | |
data_splits = command.split(' ') | |
mode = data_splits[2] | |
if(mode == 'r'): | |
receive_data(target_client) | |
elif(mode == 'w' or mode == 'a'): | |
print("enter FILE_UPDATE_QUIT to end data transfer") | |
while True: | |
data = str(input("--> ")) | |
target_client.send(bytes(data, 'utf-8')) | |
if(data == 'FILE_UPDATE_QUIT'): | |
break | |
receive_data(target_client) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment