Spaces:
Runtime error
Runtime error
File size: 332 Bytes
5bd6c7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#!/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() |