|
|
|
@ -51,7 +51,8 @@ class recver_net():
|
|
|
|
|
|
|
|
|
|
def send_thread(self, conn):
|
|
|
|
|
while True:
|
|
|
|
|
flag: int = int(input(""))
|
|
|
|
|
try:
|
|
|
|
|
flag: int = int(input())
|
|
|
|
|
if flag == 0:
|
|
|
|
|
data = input("[-] Enter data to send: ")
|
|
|
|
|
msg = {"flag": 0, "data": data}
|
|
|
|
@ -63,6 +64,8 @@ class recver_net():
|
|
|
|
|
self.send_file(conn)
|
|
|
|
|
else:
|
|
|
|
|
print("[x] Error,plesae enter 0 to send data, or 1 to send file.")
|
|
|
|
|
except ValueError:
|
|
|
|
|
print("[x] Error, please enter a valid number.")
|
|
|
|
|
|
|
|
|
|
def send_data(self, conn, data):
|
|
|
|
|
conn.sendall(data)
|
|
|
|
@ -105,6 +108,7 @@ class recver_net():
|
|
|
|
|
def run(self):
|
|
|
|
|
threading.Thread(target=self.main).start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def input_verify():
|
|
|
|
|
while True:
|
|
|
|
|
try:
|
|
|
|
@ -128,6 +132,8 @@ def input_verify():
|
|
|
|
|
else:
|
|
|
|
|
print("Invalid address format. Please enter in the format 'host:port'.")
|
|
|
|
|
return port, client_host, client_port
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# test
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
port, client_host, client_port = input_verify()
|
|
|
|
|