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. From QHostInfo get QHostadress

From QHostInfo get QHostadress

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.2k Views 1 Watching
  • 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.
  • V Offline
    V Offline
    Vardan95
    wrote on last edited by
    #1

    How can I get QHostAdress from QHostInfo?
    I have the name of host,how can I find QHostAdress of this host?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Did you try "this?":http://qt-project.org/doc/qt-5/qhostinfo.html#addresses

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vardan95
        wrote on last edited by
        #3

        QList<QHostAddress> QHostInfo::addresses() this? yeah I am now working on it but I think there might be other solution for this

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          What solution are you thinking about ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vardan95
            wrote on last edited by
            #5

            Oh, I solved this problem without using this classes, I just changed my program model :) But I think about solution like this
            @
            QList<QHostAddress> buff=info.addresses();
            for(int i=0;i<buff.size();++i)
            {
            QHostInfo temp=QHostInfo::fromName(buff[i].toString());
            if(name ==temp.hostName()) return buff[i];
            }
            @
            Something like this? Or I didn't understand those classes?

            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