from io import TextIOWrapper import socket REMOTE = "127.0.0.1" PORT = 1337 def main() -> int: s = socket.socket() s.connect((REMOTE, PORT)) sf: TextIOWrapper = s.makefile('rw') _response: str = recv(sf) sf.close() return 0 def send(sf: TextIOWrapper, msg: str) -> int: print(f"> {msg}") sent: int = sf.write(f"{msg}\n") sf.flush() return sent def recv(sf: TextIOWrapper) -> str: response = sf.readline().strip() print(f"< {response}") return response if __name__ == "__main__": exit(main())