Results 1 to 4 of 4

Thread: lists ip address range

  1. #1
    Join Date
    Mar 2011
    Location
    Greece
    Posts
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    15

    Default lists ip address range

    How can i calculate the range from an Ip?
    For example,i found that my pc's current local ip is 192.168.1.2.I want to list from 192.168.1.1 to 192.168.1.254.
    Also,is there a way to calculate the netmask length?
    Any help would be appreciated!

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

    Default Re: lists ip address range

    There is no way to retrieve a netmask from an IP address. You need to know the mask for a particular subnet.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    milli (17th May 2011)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: lists ip address range

    If that is the address of one of your local machine interfaces then you can get the network mask (or prefix length) for that interface in the relevant QNetworkAddressEntry otherwise, as Wysota says, you cannot derive it.

  5. #4
    Join Date
    Mar 2011
    Location
    Greece
    Posts
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    15

    Default Re: lists ip address range

    Quote Originally Posted by ChrisW67 View Post
    If that is the address of one of your local machine interfaces then you can get the network mask (or prefix length) for that interface in the relevant QNetworkAddressEntry otherwise, as Wysota says, you cannot derive it.
    Yes it is the address of my local machine interface,and i have used the class QnetworkAddressEntry to get both ip address and netmask.Prefix length is that i wanted,i used to call it number of network bits or netmask length and it is confusing me.
    Thanks a lot..!

Similar Threads

  1. Replies: 1
    Last Post: 23rd April 2011, 17:33
  2. QDoubleVlaidator range
    By johnmauer in forum Qt Programming
    Replies: 1
    Last Post: 20th October 2010, 16:08
  3. List View with sections for alphabetialy sorted list
    By woodtluk in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2010, 11:50
  4. Out of range detection
    By zgulser in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2009, 09:32
  5. QLineEdit set min max range?
    By whitefurrows in forum Qt Programming
    Replies: 29
    Last Post: 10th June 2006, 23:51

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
  •  
Qt is a trademark of The Qt Company.