init repo

This commit is contained in:
asus
2023-02-06 15:44:48 +01:00
parent 5874252a02
commit 72f305d8eb
6 changed files with 302 additions and 0 deletions

22
server.py Normal file
View File

@@ -0,0 +1,22 @@
import socket
host = 'localhost'
port = 9999
address = (host, port)
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.bind((address))
server_socket.listen(5)
print ("Listening for client . . .")
conn, address = server_socket.accept()
print ("Connected to client at ", address)
while True:
try:
output = conn.recv(2048)
if output:
print ("Message received from client:")
print (output)
except:
sys.exit(0)