Announcement

Collapse
No announcement yet.

How to get the ipv4-addres?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get the ipv4-addres?

    I want to get the local IP address but I dont get it.
    I am using HOST ADDR
    How do I do?Click image for larger version  Name:	IPV4.png Views:	4 Size:	18.0 KB ID:	786915
    Last edited by Fim Wästberg; 29 Nov 2019, 09:53 AM.
    Fim Wästberg

  • #2


    It is possible for a computer to have more than one IP address. For example, if you have a network card in your computer, and you are dialed into the Internet using a modem, your computer will have two IP addresses. By using the indexed form of the statement:

    HOST ADDR(index&) TO ip&

    …you can retrieve the first IP address with index& = 1, the second with index& = 2, etc. If, on return, ip& contains zero (0), there are no further IP addresses to retrieve on that computer.


    Loop until you get one that starts with 192

    Comment


    • #3
      What indexnum (if any) are you passing to HOST ADDR? How many IP interfaces does your computer have?

      (((suggested correction to subject - "How to get the ip v4-addres? " The V stands for version, )))
      Dale

      Comment


      • #4
        Stuart,
        Big thanks, works great.
        in addition to 192. I also include 10.
        Fim Wästberg

        Comment


        • #5
          Keep in mind that if you're behind a NAT router, which the vast majority of people are these days, that IP address returned by ipconfig is not going to be useful (it'll be a non-routable address). If you want their external routable address, you'll need to use a different approach.
          Mike Stefanik
          sockettools.com

          Comment

          Working...
          X