Client cannot connect to server [Errno 111]

Question:
How do I made replit accept the client’s connection? Replits throws an error.
Repl link:
https://replit.com/@-jpg/disconnect-SERVER server
https://replit.com/@-jpg/disconnect client

Traceback (most recent call last):
  File "main.py", line 7, in <module>
    client_socket.connect(('localhost', 3496))
ConnectionRefusedError: [Errno 111] Connection refused

you are connecting to localhost. Remember that’s from a tutorial where they aren’t hosting it on the web. Change it so that the server is running on host 0.0.0.0 and client is going to repl_url also I’d use websockets

i didnt use a tutorial, thank you however

1 Like

oh ok didn’t realize lol

what do i replace portnum with
server_socket.bind(('0.0.0.0', portnum))

1 Like

8080 also I would use websockets…

Yes, I will try with websockets l8r. Says 8080 is already in use.

Traceback (most recent call last):
  File "main.py", line 9, in <module>
    server_socket.bind(('0.0.0.0', 8080))
OSError: [Errno 98] Address already in use
1 Like

interesting I don’t know I just use websockets

i got it to work with 8081, but i put https://replit.com/@-jpg/disconnect-SERVER instead of 0.0.0.0 for the client and it says it doesnt recognize it

1 Like

do you know what i should do

1 Like