Page 1 of 2

IP address

Posted: Sun Jun 27, 2004 3:39 pm
by PB
I just tested this to get my IP address:

Code: Select all

InitNetwork() : ExamineIPAddresses()
Debug IPString(NextIPAddress())
But the result is different to what's seen at www.showmyip.com -- why?

I have an ADSL connection that requires logon (ie. not always on) and
my IP address is dynamic, not static -- but it's weird that the values differ.

Posted: Sun Jun 27, 2004 3:58 pm
by Pupil
Maybe you're ISP/(or you) is using a NAT and you're behind it? Have you tried with NextIPAddress() in case you have more than one IP address..

Posted: Sun Jun 27, 2004 4:05 pm
by thefool
normally when you have adsl, your computers ip is the local one. The public ip (the one others need to use to contact you) you can only get from outside. Theres no way to find out, if you dont have a server or something else on the outside. You could extract the IP from one of those pages.

Posted: Mon Jun 28, 2004 12:06 am
by PB
@thefool: Thanks for the info.

@Pupil: Yes, I tried NextIPAddress() and it returned 0 after the first call.
I don't know what a NAT is... I just connect to my ADSL account with a
USB modem and that's it. I'm running ZoneAlarm but having it off doesn't
seem to make a difference.

Posted: Mon Jun 28, 2004 1:05 am
by GeoTrail
It works for me, and I'm on a 2 mbit DSL line.

Re: IP address

Posted: Mon Jun 28, 2004 4:29 am
by NoahPhense
PB wrote:I just tested this to get my IP address:

Code: Select all

InitNetwork() : ExamineIPAddresses()
Debug IPString(NextIPAddress())
But the result is different to what's seen at www.showmyip.com -- why?

I have an ADSL connection that requires logon (ie. not always on) and
my IP address is dynamic, not static -- but it's weird that the values differ.
Bah, it's only one site.. but if someone had sometime, they could add
more, like backups, if one fails it could move on.. I think there are like
4 mainstream ip places...

Code: Select all

; English forum: http://jconserv.net/purebasic/viewtopic.php?t=7857&highlight=
; Author: ricardo (based on older Forum code)
; Date: 11. October 2003
; -----------------------
; Modified by NoahPhense
; Date: 27. June 2004
; note: Thought I saw something like this somewhere, but couldn't
;       find it, so I modified some old code.  This code is meant
;       to rip pages.  So I'm just parsing the ripped page.

Procedure.s OpenURL(Url.s, OpenType.b) 
  isLoop.b=1 
  INET_RELOAD.l=$80000000 
  hInet.l=0: hURL.l=0: Bytes.l=0 
  Buffer.s=Space(2048) 
  
  hInet = InternetOpen_("PB@INET", OpenType, #NULL, #NULL, 0) 
  hURL = InternetOpenUrl_(hInet, Url, #NULL, 0, INET_RELOAD, 0) 
  
  Repeat 
    
    Delay(1) 
    InternetReadFile_(hURL, @Buffer, Len(Buffer), @Bytes) 
    If Bytes = 0 
      isLoop=0 
    Else 
      res.s = res + Left(Buffer, Bytes) 
    EndIf 
  Until isLoop=0 
  InternetCloseHandle_(hURL) 
  InternetCloseHandle_(hInet) 
  ProcedureReturn res 
EndProcedure 
 

URL$ = "http://www.ipaddressworld.com" 
HTML$ = OpenURL(URL$, 1)
q.s = Chr(34)
mainString.s = "<font face="+q+"Verdana, Arial, Helvetica, Sans-serif"+q+" size="+q+"+6"+q+">"

mod_1 = FindString(HTML$, mainString, 1)
mod_2.s = Mid(Html$, mod_1, 100)
mod_3 = FindString(mod_2, ">", 1)
mod_4.s = Mid(mod_2, 62, 15)
mod_5 = FindString(mod_4, "<", 1)
mod_6.s = Mid(mod_4, 1, mod_5-1)

MessageBox_(0, "External IP Address :: " + mod_6, "IP", #MB_SYSTEMMODAL)

End

** edit **
nice, i just looked at the site you listed.. that's much easier to parse, the
ip is near the front

<HTML><HEAD><TITLE>IP Address properties of your Internet
Connection *.*.*.*


- np

Re: IP address

Posted: Mon Jun 28, 2004 4:40 am
by PB
> Bah, it's only one site.. but if someone had sometime, they could add
> more, like backups, if one fails it could move on.. I think there are like
> 4 mainstream ip places...

Hmm, I just checked my IP at these sites, and they say:

www.showmyip.com = 203.26.24.221
www.ipaddressword.com = 203.26.24.222

Update: I just checked my IP address for this post , and it's 203.26.24.214...
and no, I haven't disconnected and reconnected my ADSL connection during
these three tests. So now I'm REALLY confused... which one do I believe? :(

Re: IP address

Posted: Mon Jun 28, 2004 4:57 am
by NoahPhense
PB wrote:> Bah, it's only one site.. but if someone had sometime, they could add
> more, like backups, if one fails it could move on.. I think there are like
> 4 mainstream ip places...

Hmm, I just checked my IP at these sites, and they say:

www.showmyip.com = 203.26.24.221
www.ipaddressword.com = 203.26.24.222

Update: I just checked my IP address for this post , and it's 203.26.24.214...
and no, I haven't disconnected and reconnected my ADSL connection during
these three tests. So now I'm REALLY confused... which one do I believe? :(
Wish I knew. Never had that occur, ever. I recommend setting fire to the
computer, run out of the house and down the street screaming,
"I didn't mean to kill her.. she just wouldn't eat her peas!!"

*edit*

That's strange.. tomorrow, I will look at alternate routes. But from todays
research, there is no simple way.

Even the expert boards I've been to, say, you need to get the IP from
a web page..

The code above does nothing special, just grabs the IP from those sites.

- np

Posted: Mon Jun 28, 2004 7:10 am
by thefool
try http://myip.dk
its a danish site. But it have been up long time and i havent had any trouble with it. used it for games playing and that stuff.

[quote=geotrail]It works for me, and I'm on a 2 mbit DSL line.[/quote]

You say that you are on an DSL line. There is some difference with xDSL and ADSL and that stuff. Are you sure you have an ADSL line?

@PB: are you sure you dont have a router? If your usb modem can be used with more than 1 computer, i may have a kind of router.
Maybe i can find out if you give me the name of the modem.


[quote=NoaPhence]Even the expert boards I've been to, say, you need to get the IP from
a web page.. [/quote]

Isnt this a kind of expert board? :D

Posted: Mon Jun 28, 2004 7:28 am
by PB
> @PB: are you sure you dont have a router? If your usb modem can be
> used with more than 1 computer, i may have a kind of router.
> Maybe i can find out if you give me the name of the modem.

It's a D-Link DSL-200, as seen here:
http://www.dlink.com.au/products/broadband/dsl200/

Posted: Mon Jun 28, 2004 7:38 am
by thefool
Your modem uses PPPoE. I think that is it. Dont worry its a good thing :D

info about pppoe: http://www.carricksolutions.com/pppoe/

Posted: Mon Jun 28, 2004 12:26 pm
by GeoTrail
thefool, your right.
On my ISP's site it says ADSL. Sorry about that :(

Posted: Mon Jun 28, 2004 12:33 pm
by thefool
well thats ok. :D

..

Posted: Mon Jun 28, 2004 3:16 pm
by NoahPhense
NoahPhence wrote:Even the expert boards I've been to, say, you need to get the IP from a web page..
thefool wrote:Isnt this a kind of expert board? :D
Yes, we are experts, experts in the art of gathering and using information
to feed our creation process. As we are developers, creators, binary
sculpters if you will.. ;)

And what makes us good developers is our ability to know our limitations.

As for the "experts" that I am refering to in my above post. Are experts
of Transmission Control Protocol - Internet Protocol (TCP/IP).

And what I've found makes perfect sense, for those of us that are behind
a firewall OR router OR both. We are trying to 'hack' our own systems by
touching outside the wall to find our number. There is no easy way. That
is why these sites exist.

I haven't found just one overall solution. I've found a few individual ones
but not ones I would integrate into any of my applications.

- np

I will keep looking. Worst case scenario, which is actually a great idea for
me. Is the following. Becuase some of my software plans to have an
updater like, PB, and TailBite, etc.. I will end up using my own site to
grab the users IP from..

Posted: Tue Jun 29, 2004 1:22 am
by PB
> try http://myip.dk

Okay, here's the results from today's ADSL session:

http://myip.dk = 203.26.24.211
www.showmyip.com = 220.245.73.143
www.ipaddressworld.com = 203.26.24.222
This forum's "IP" button = 220.245.73.143
My code from this thread = 220.245.73.143
Client IP address = 220.245.73.143*
Server IP address = 202.7.162.108*

* = Obtained by double-clicking the modem icon in the System Tray.

So... I really don't know what the heck is going on. :( However, the
majority of them seem to be 220.245.73.143 so I guess I should use
that as the "real" IP address when wanting to remotely access my PC,
and it's good to see that my PureBasic code gets the majority one. :)