'PC client - Repl.it server comunication

I want to comunicate between client and server but when i was searching information on this topic I found only pc - pc or repl - repl comunication. I need to somehow connect multiple clients on computers to one Repl.it server.

Currently I am using this code that I found somewhere else.

PC Client:

import socket

HOST = "127.0.0.1"  
PORT = 65432  

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((HOST, PORT))
    s.sendall(b"Hello, world")
    data = s.recv(1024)

print(f"Received {data!r}")

Repl.it Server:

import socket

HOST = "127.0.0.1"  
PORT = 65432  

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.bind((HOST, PORT))
    s.listen()
    conn, addr = s.accept()
    with conn:
        print(f"Connected by {addr}")
        while True:
            data = conn.recv(1024)
            if not data:
                break
            conn.sendall(data)

I know it has to do something with IP adresses (something is local and something isnt...) but I don´t know how to fix it. When I tried to find IP adress of my repl and use it showed me this error: [Errno 99] Cannot assign requested address

I need somehow connect this two.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source