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. how to recognize if ip address(es) has changed

how to recognize if ip address(es) has changed

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 1.1k 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.
  • LeoCL Offline
    LeoCL Offline
    LeoC
    wrote on last edited by
    #1

    Hey,

    I wonder how I can recognize the change of the ip address(es) of my interface.
    Since I guess there is no "ip address change event" I need a workaround for this. It would be sufficient to know the number of the assigned ip addresses.

    One thing I can imagine would be: using a timer to read all ip addresses every certain period.

    But perhaps there is something different I can use. Any ideas?

    Regards.

    raven-worxR 1 Reply Last reply
    0
    • LeoCL LeoC

      Hey,

      I wonder how I can recognize the change of the ip address(es) of my interface.
      Since I guess there is no "ip address change event" I need a workaround for this. It would be sufficient to know the number of the assigned ip addresses.

      One thing I can imagine would be: using a timer to read all ip addresses every certain period.

      But perhaps there is something different I can use. Any ideas?

      Regards.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @LeoC
      Qt only provides a QnetworkInterface class, but it doesn't provide the functionality you need.
      The only thing you could do is polling, but this is probably a bad idead (performancewise).

      I think there is no way around then to use the native OS API.
      For example using WinAPI: NotifyAddrChange function should basically do what you want.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • Ni.SumiN Offline
        Ni.SumiN Offline
        Ni.Sumi
        wrote on last edited by
        #3

        Hi @LeoC ,

        I guess, this is what you are looking. Is the IP Address changed when you set the new Connection or wifi / cable changes ?
        For both , this signal will work.

        http://doc.qt.io/qt-5/qnetworksession.html#stateChanged

        1 Reply Last reply
        1

        • Login

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