LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read public IP with labview?

Hello guys,

As you may know we can read the IP of the PC with Labview with some functions of the TCP communication palette. But those functions doesnt give us the public IP of our network.
Is there a way to obtain the Public IP of aour network? do we need to contact a server?

Thanks
0 Kudos
Message 1 of 19
(4,827 Views)
The public IP is determined by your internet connection type. You will typically have several pieces of hardware between your PC and the outside connection like a router and/or cable/DSL modem. Furthermore, if you have a dynamic public IP address that can change. Your local PC has no knowledge of this. It just knows about the router to talk to. To find out your public IP address you need to see what someone from the outside sees, since there could be all sorts of NAT'ing going on inside your network.

For instance, http://whatismyipaddress.com/ will return to you your public IP address. You can get this page from within LabVIEW and parse it to get the address. There's bound to be other such pages on the net that may provide a simpler output that will be easier to parse.
0 Kudos
Message 2 of 19
(4,815 Views)
Yes,

That is exactly the IP type i got : Dinamyc. This is a stronger reason to read always that IP so i can notify some GPRS Modem that the IP change. That alone would save me here in mexico $180 dollars per month. Maybe i could do it with a  "text code" languaje programming IDE like Delphi ( i found examples on the Web) but i wanted to do it in Labview so i would save the work to intercommunicating two apps.

Do you have examples of web pages parsing???

Thank you very much
0 Kudos
Message 3 of 19
(4,791 Views)
I'm not sure what you're doing, but perhaps a service like dyndns.org would help you. Their service is free, but you'll get a periodic email to confirm the account is still active. Most router/gateways nowadays have an option to automatically update a service like this.

In terms of parsing it depends on which OS you're on. If you're on Windows you can just use the IE ActiveX interface to navigate to the URL and get the HTML as a string. Then you can just use standard string functions to find the text. An example of using the IE ActiveX interface is here. Another is here (essentially does the same thing as the previous one, but with a callback). You can also do this using TCP/IP functions by sending the appropriate GET command and reading back what the server returns.
0 Kudos
Message 4 of 19
(4,779 Views)
try this site: http://whatismyip.org/
it is easy to parse since the only content on the page is your public ip address.  However, do not poll this website too often or you will get rejected (I beleive the max you can poll is 4 or 5 times a minute and they recommend no more than once every 10 mins)
0 Kudos
Message 5 of 19
(4,730 Views)
Thank you,

It is really usefull, both of you, thanks again, i will work on this today and try to post results. You see what i am trying to do is to update every hour maybe my public IP and send the new IP to a remote station with a GPRS Modem just to save me the bucks for having a static IP. It is very expensive here in Mexico that.

Thank you again guys.
0 Kudos
Message 6 of 19
(4,713 Views)
Why would your public IP change that frequently? Even so, propagation through the internet takes 24-48 hours, not 1 hour.
0 Kudos
Message 7 of 19
(4,707 Views)
Well, will never know the change rate do we?

Some times it changes once per month, but in some ocations when a power failure occurs here in the city and computers and modem shut down, it seems we loose the IP....When power is retored the modem has a different IP. So i want to check up every hour or maybe 4 hours perphaps, because i have a sensor colecting valuable data on the field and if my IP changes i loose the data ( Idont have data storage in flash yet).

Propagation delays may take 48 hours, but to travel around the world....I not going to have very distant points from me i think. anyway i just want to save some $$$.
0 Kudos
Message 8 of 19
(4,700 Views)
Could i use firefox instead of IE?

I am having some problems with the page :
http://whatismyip.org/

Labview and IE cant open it, only Firefox can, i wonder if it could be possible to use firefox instead of IE to do that or waht is happening?
0 Kudos
Message 9 of 19
(4,682 Views)
I was able to open that URL just fine in IE.
0 Kudos
Message 10 of 19
(4,672 Views)