Why python socket client doesn't connect to the server?
I am trying to host a python socket server in repl.it. I can connect the server by opening repl.co in my browser but the client does not connect.
import socket HOST = "0.0.0.0" PORT = 1080 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind((HOST, PORT)) s.listen() conn, addr = s.accept() with conn: print("Connected by", addr) while True: data = conn.recv(1024) if not data: break conn.sendall(data)
import socket HOST = "Socket-Test.onenose.repl.co" PORT = 1080 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.connect((HOST, PORT)) s.sendall(b"MEOW!") data = s.recv(1024) print("Recieved", repr(data))
What am I doing wrong?