Detect Gateway IP address in windows

Alex Tweedly alex at tweedly.net
Fri Oct 8 20:03:01 EDT 2004


At 10:36 08/10/2004 -0400, RGould8 at aol.com wrote:

>I've seen techniques for retrieving the user's local IP address in Windows
>into a Revolution variable, but I haven't yet seen an example of how one goes
>about retrieving the "gateway ip address".   (For example, the IP address 
>of a
>DSL router connected to the PC.)   Can anyone tell me how one could retrieve
>this info in Windows?

I tried not to ask - but I can't help myself .....

why do you need to know the gateway address ?
or, if you prefer, what do you want to use it for ?

There have been a few suggested ways to find i tout (and there are a couple 
of others, probably even less "perfect"); knowing what you want to use it 
for would help to give you the best answer (or at least to point out the 
constraints and difficulties with each particular way).

Note that in the right circumstances, it's possible to have a machine 
connected to, and able to talk to, the Internet with :
  - no gateway address
  - a gateway address which is not used to reach the internet
  - a gateway address which is not reachable from the Internet, even though 
the machine itself is able to talk to the 'net
  - a gateway address which does not represent a host (i.e. you can't 
communicate with it)
  - multiple gateways, each used for different parts of the net

On principle, I'd say you should try not to need to know this info :-)

-- Alex.


More information about the use-livecode mailing list