Network examples only work on my local network

  • Hi, I've been trying to make a server application that would allow a connection with a client app. running on a computer, anywhere. To do so, I used the Fortune Server example and the Fortune Client example. Everything works fine when the 2 applications connect through local IPs, but I can't get it to work on public IPs.

    The "QNetworkInterface::allAddresses()" in my server applications only returns addresses like "192.168..." or "169.254...", etc... which from my very basic understanding, are only local IPs. So, how come I can't seem to get public IPs from this function?

    Also, I tried hard coding my IP that I found through google in my client application, but even then it would say "The connection was refused by the peer...".

    Any help would be greatly appreciated, thanks!

  • @SoftEngi Because your machine doesn't have a public IP, only your modem/router has one. If you want your server application to be accessible via the public IP you have to forward its port to your modem's. This operation can be done via your modem/router web interface.

  • @raf924 Makes perfect sense, thanks! :)

Log in to reply