Results 1 to 5 of 5

Thread: QHostInfo usefullness

  1. #1
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QHostInfo usefullness

    Guys,

    I have an app that is an interface to an electronic system and the connection between the system and my app is through ethernet using TCP/IP style and trough a network. My app would be responsible for assingning the IP address to the system that its currently talking to trough an RS232 link which a default connection when a system boots up.

    Anyways, my question is that how can i make sure that an IP address is free ( or no conflict in the network). My plan is to use QHostInfo (I will keep a list of addresses that i have to check ) and keep trying to QHostInfo::lookUpHost(mylistofipaddress) and if no error returned then i would mark that address as taken. Is there any other easy way to do this?

    baray98

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QHostInfo usefullness

    It could take some time to test all the addresses...
    Can't you just let the user input the IP he/she wants for the system?

  3. #3
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QHostInfo usefullness

    I guess i could but the problem would be if the address is used by the other system so when my app runs it will ping two systems...and so there will be confusion.

    baray98

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QHostInfo usefullness

    Quote Originally Posted by baray98 View Post
    I guess i could but the problem would be if the address is used by the other system so when my app runs it will ping two systems...and so there will be confusion.

    baray98
    Oh, so your application will be run by plain users... In this case you can go with your solution and add a non-finishing progress bar, so the user sees something while the IP's are being looked up.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QHostInfo usefullness

    Quote Originally Posted by baray98 View Post
    I guess i could but the problem would be if the address is used by the other system so when my app runs it will ping two systems...and so there will be confusion.
    Why not keep a shared database of addresses which are currently used in the network and just ask the database for an unused address? That's how dhcp servers work.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.