You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
270 B
Python

from socket import *
from struct import *
while True:
st = input(">>> ")
s = socket(AF_INET, SOCK_STREAM)
s.connect(("127.0.0.1", 8888))
s.sendall(pack("!i", len(st.encode())))
s.sendall(st.encode())
print(s.recv(len(st)).decode())
s.close()