Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Network examples only work on my local network

Network examples only work on my local network

Scheduled Pinned Locked Moved Solved General and Desktop
networktcp
3 Posts 2 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SoftEngi
    wrote on last edited by
    #1

    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!

    R 1 Reply Last reply
    1
    • S SoftEngi

      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!

      R Offline
      R Offline
      raf924
      wrote on last edited by
      #2

      @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.

      S 1 Reply Last reply
      2
      • R raf924

        @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.

        S Offline
        S Offline
        SoftEngi
        wrote on last edited by
        #3

        @raf924 Makes perfect sense, thanks! :)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved