I am making a cli-chat system with python, sockets. When the server and client are in the same machine, the code works fine.
But now I am trying to port forward my local server with ngrok, to chat with remote clients.
When the client wants to connect he would have to give the server url. If I am giving my localhost url, client connects to the socket server and everything works fine.
But whenever I am giving the ngrok's tcp tunnel url, it doesn't works and throws the error below
Traceback (most recent call last):
File "/storage/emulated/0/Sun/Python/cmd-chat/user.py", line 5, in <module>
client.connect((serverUrl, 5000)) #connecting client to server
socket.gaierror: [Errno 7] No address associated with hostname
The url I am giving as input is,
tcp://x.tcp.ngrok.io:17xxx
Hey I think I got where you are going wrong
# Your Server Url should be
serverUrl = hostAddress = "x.tcp.ngrok.io"
# The Port in which we want to connect to the server Should be
port = 17234 # The number given in the end of URL link