get ip
get ip
get ip
get ip
get ip
get ip get ip get ip get ip get ip get ip get ip get ip
get ip get ip
get ip
Go Back  Xtreme Visual Basic Talk > > > get ip


Reply
 
Thread Tools Display Modes
  #1  
Old 07-06-2003, 04:23 AM
0byte 0byte is offline
Newcomer
 
Join Date: May 2002
Location: home
Posts: 22
Default get ip


hi, i have a question.
how can i find my ip when i connect to the internet.
i used an api call, but it showed my local ip.
thanks in advance
__________________
640k are enough :)
Reply With Quote
  #2  
Old 07-06-2003, 05:39 AM
Squirm's Avatar
Squirmget ip Squirm is offline
Political Coder

Retired Moderator
* Guru *
 
Join Date: Mar 2001
Location: London, England
Posts: 8,037
Default

There has been much debate over this topic, but the only real way seems to be to connect to some remote machine and have them tell you what your IP is. You can programmatically connect to www.whatismyip.com with INet or Winsock, and then parse the returned HTML to obtain the IP.
__________________
Search the forums | Use [vb][/vb] tags | Still IRCing
Reply With Quote
  #3  
Old 07-06-2003, 07:28 AM
0byte 0byte is offline
Newcomer
 
Join Date: May 2002
Location: home
Posts: 22
Default

thank you.
__________________
640k are enough :)
Reply With Quote
  #4  
Old 07-06-2003, 07:58 AM
zhitzu zhitzu is offline
Newcomer
 
Join Date: Jun 2003
Posts: 19
Default

I'm from Denmark so I know a Danish side... it's a little cooler than whatsmyip.com! Just my opinion!! www.myip.dk
Besides, you can code one yourself! It's very easy!
Reply With Quote
  #5  
Old 07-06-2003, 11:30 AM
VBCODEX's Avatar
VBCODEX VBCODEX is offline
Centurion
 
Join Date: Jun 2003
Location: Far away from you
Posts: 119
Default

you can just add a winsock control on your project and Winsock1.LocalIP returns your IP (does to me)
__________________
You never realise a mistake until you've made the mistake
[VBc0deX]
Reply With Quote
  #6  
Old 07-06-2003, 12:58 PM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,596
Default

hi, id just like to know What is an ip address?

ive heard everyone talking about them, someone said never to give it out over the net cos you can be hacked or something.

what is it all about?????
__________________
"That which seems simple is often overlooked" ~ me
Halloween 2014 Yard Haunt
Halloween Special FX
Reply With Quote
  #7  
Old 07-06-2003, 02:53 PM
Athiril Athiril is offline
Newcomer
 
Join Date: May 2003
Posts: 17
Default

actually, in my FTP program, i had to refer to some tutorial and code, you can get ALL the IP addresses of your machine, but you must decide which one you want to use, what i did was block out all the 192.*.*.* addresses as local addresses, and only collected ip addresses which wasn't that, which was my internet adapter address.

so you're Danish huh? cool, my heritage is of Danish Vikings that went to Ireland.
Reply With Quote
  #8  
Old 07-06-2003, 05:37 PM
manavo's Avatar
manavo manavo is offline
Junior Contributor
 
Join Date: Jun 2003
Location: Greece
Posts: 366
Default

Quote:
Originally Posted by VBCODEX
you can just add a winsock control on your project and Winsock1.LocalIP returns your IP (does to me)


I disagree with this method because with test I have done it gets your IP address when your form loads and it can't detect changes. For example before you connect to the internet your IP will be 127.0.0.1 right? That is what the winsock control will show. But, if while you are running the program you connect to the internet it will still show you 127.0.0.1 . So I would suggest either to finding it from a website or there is an API way to do it (unfortunatelly I don't have the module right now. If you want I can look for it and post it here)
__________________
No one is completely useless. They can at least be an example of what to avoid.
Reply With Quote
  #9  
Old 07-06-2003, 10:21 PM
chibishmoo chibishmoo is offline
Junior Contributor
 
Join Date: Jun 2003
Posts: 225
Default

Quote:
Originally Posted by the master
hi, id just like to know What is an ip address?

ive heard everyone talking about them, someone said never to give it out over the net cos you can be hacked or something.

what is it all about?????




Man, I'm a little confused as to what your doing on the communications part of the board without even knowing what an IP is... Its kinda like going into enemy territory unarmed....

Anyway, very simply, an IP address is... well the address at which your connection to the internet is located. If you didnt have an address how would information reach the correct destinations. If somone knows your IP address, it simply means they know a place to START hacking. However if you are protected with routers and firewalls, it is much harder to be hacked. Just remember... THERE IS ALWAYS A WAY TO BE HACKED, no matter how much protection you have...

So anyway, if you were creating, say a visual basic project with winsocks, and you needed your server to send some information to a client, one of your instances of the winsock would have the location of the other winsock, or their IP adress, memorized, so it knows where to send the data it needs.
Reply With Quote
  #10  
Old 07-07-2003, 02:26 PM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,596
Default

ok, thanx. i just wondered about it

Quote:
Originally Posted by chibishmoo
Man, I'm a little confused as to what your doing on the communications part of the board without even knowing what an IP is...



well where better to learn about communication stuff than here
__________________
"That which seems simple is often overlooked" ~ me
Halloween 2014 Yard Haunt
Halloween Special FX
Reply With Quote
  #11  
Old 07-07-2003, 05:21 PM
ICeMaN_179 ICeMaN_179 is offline
Restricted
 
Join Date: Oct 2002
Location: UK
Posts: 682
Default

Quote:
Originally Posted by manavo
I disagree with this method because with test I have done it gets your IP address when your form loads and it can't detect changes...

You could use a timer that would perdiodically update with the code
Code:
Winsock1.LocalIP
Reply With Quote
  #12  
Old 07-07-2003, 06:26 PM
manavo's Avatar
manavo manavo is offline
Junior Contributor
 
Join Date: Jun 2003
Location: Greece
Posts: 366
Default

Quote:
Originally Posted by ICeMaN_179
Quote:
Originally Posted by manavo
I disagree with this method because with test I have done it gets your IP address when your form loads and it can't detect changes...

You could use a timer that would perdiodically update with the code
Code:
Winsock1.LocalIP


That is the problem. It doesn't! If you follow the example I posted above you will see that the LocalIP will be the same even if your internet status changes! The API way won't. That is why I prefer it
__________________
No one is completely useless. They can at least be an example of what to avoid.
Reply With Quote
  #13  
Old 07-08-2003, 11:37 AM
0byte 0byte is offline
Newcomer
 
Join Date: May 2002
Location: home
Posts: 22
Default

thanks to Squirm's advice i solved my problem using a small php script that generates a plain txt file with the ip.
10x all for the replies.
__________________
640k are enough :)
Reply With Quote
  #14  
Old 07-09-2003, 07:40 PM
vbtester vbtester is offline
Junior Contributor
 
Join Date: May 2002
Posts: 211
Cool

To clear up any confusion for anyone else reading this post. The only way you can "Accurately" determine your WAN IP address, that’s your internet IP assigned by your ISP is to connect to a remote server and have it report back your IP address.

All these rumors about being able to use a magical undocumented API call are simply "Rumors". I say this because it will not work when you are behind a network.

Also the idea of having your own Winsock control tell you your IP address, this will not work either if you are behind a network, all you will see is your LAN IP.

The only sure way to do this is to connect to a remote server, have it return your IP address to you via a text file, a socket connection or a simple HTML file which you can parse using VB or any other language.

The reason for this is when your computer uses a Winsock control behind a network, the control grabs your IP address. But this IP address is not the IP address you use to connect to the internet. It is the IP address you use to connect to your Router or Domain Controller which then forwards your request over the internet to the destination server. When your request is sent to a server on the internet, the destination server will see your Routers IP or Domain Controllers IP address, which is actually the address assigned to you by your ISP. The destination server will never see your LAN IP (192.***.***.***), so when it reports back to you with your IP address you can be assured it will only be able to report back your WAN IP address which was assigned by your ISP.
Reply With Quote
  #15  
Old 07-10-2003, 09:46 AM
manavo's Avatar
manavo manavo is offline
Junior Contributor
 
Join Date: Jun 2003
Location: Greece
Posts: 366
Default

Well I haven't checked this module on a network but I know for a fact that it is better than the winsock way...
Attached Files
File Type: bas Module1.bas (5.0 KB, 23 views)
__________________
No one is completely useless. They can at least be an example of what to avoid.
Reply With Quote
  #16  
Old 07-10-2003, 11:44 AM
vbtester vbtester is offline
Junior Contributor
 
Join Date: May 2002
Posts: 211
Default

Quote:
Originally Posted by manavo
Well I haven't checked this module on a network but I know for a fact that it is better than the winsock way...



Like I said before, this will not work if you are on a network. It will only return the LAN IP given to you by your domain controller or router.

This code will not return your WAN IP address (assigned by your ISP). You can only do this by connecting to a remote server.
Reply With Quote
  #17  
Old 07-10-2003, 06:24 PM
manavo's Avatar
manavo manavo is offline
Junior Contributor
 
Join Date: Jun 2003
Location: Greece
Posts: 366
Default

OK. Thanks for the info. As I said I had never tested it...
__________________
No one is completely useless. They can at least be an example of what to avoid.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
get ip
get ip
get ip get ip
get ip
get ip
get ip get ip get ip get ip get ip get ip get ip
get ip
get ip
 
get ip
get ip
 
-->