Spaces:
Runtime error
Runtime error
#!/usr/bin/python3 | |
import socket | |
import sys | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
host = socket.gethostname() | |
port = 9999 | |
s.connect((host,port)) | |
while True: | |
msg = s.recv(1024).decode("utf-8") | |
print("server:",msg) | |
msg = input("client: ") | |
if not msg: break | |
s.sendall(msg.encode("utf-8")) | |
s.close() |