Networking Forums

Networking Forums > Computer Networking > Linux Networking > How to get default Gateway address, subnet address, DNS names using C/C++

Reply
Thread Tools Display Modes

How to get default Gateway address, subnet address, DNS names using C/C++

 
 
Matrixinline
Guest
Posts: n/a

 
      01-09-2007, 12:26 PM
Hi,

Can any one please let me know that how to get IP address of the
current machine, default gateway, DNS name , subnet address using C/C++

thanks
Anup

 
Reply With Quote
 
 
 
 
horvatj
Guest
Posts: n/a

 
      01-09-2007, 12:36 PM
Dear Matrixinline,

You may take a look at netdb.h...

There you can find some structs like:
- servent
- netent
- hostent
etc.

There are several functions, which give you the desired infos:
getnetbyaddr, getnetbyname

Hop that hels a little bit.
Johann

Matrixinline wrote:

> Hi,
>
> Can any one please let me know that how to get IP address of the
> current machine, default gateway, DNS name , subnet address using C/C++
>
> thanks
> Anup


 
Reply With Quote
 
Matrixinline
Guest
Posts: n/a

 
      01-11-2007, 04:32 AM
HI horvatj,

Thanks for the help but I do not get the default gateway
names/addresses and DNS address from the functions available on the net
library.

-Anup


horvatj wrote:
> Dear Matrixinline,
>
> You may take a look at netdb.h...
>
> There you can find some structs like:
> - servent
> - netent
> - hostent
> etc.
>
> There are several functions, which give you the desired infos:
> getnetbyaddr, getnetbyname
>
> Hop that hels a little bit.
> Johann
>
> Matrixinline wrote:
>
> > Hi,
> >
> > Can any one please let me know that how to get IP address of the
> > current machine, default gateway, DNS name , subnet address using C/C++
> >
> > thanks
> > Anup


 
Reply With Quote
 
 
 
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IP Address is in a different subnet as the gateway address karthik Network Routers 2 04-30-2008 01:55 AM
My Router does not accept a gateway ip that has a subnet address different from the laptop ip address keethyanandpr@gmail.com Wireless Internet 15 03-18-2007 04:03 PM
Can't set default gateway address on MN-520 Sid9 Broadband Hardware 9 02-03-2004 04:09 PM
default gateway address thudd Linux Networking 2 12-27-2003 08:35 PM
wrong default gateway address Ron Windows Networking 0 10-01-2003 02:58 AM



1 2 3 4 5 6 7 8 9 10 11