5

I want to use in my code local DNS addresses and am looking for a library that would produce it. Is there anything like it or do I have to parse /etc/resolv.conf myself?

Thanks

R3v3r3nD
  • 111
  • 1
  • 6

2 Answers2

6

You can use the resolver functions as described in the answer to this question or read the addresses of name servers from the file /etc/resolv.conf which is a simple text file, such as

# Generated by NetworkManager
nameserver x.x.x.x
nameserver y.y.y.y

where x.x.x.x and y.y.y.y are ip addresses.

Community
  • 1
  • 1
vitaut
  • 49,672
  • 25
  • 199
  • 336
  • Thanks for pointing me in the right direction. I Finally used the links you provided plus functions described [here](http://beej.us/guide/bgnet/output/html/multipage/inet_ntopman.html). – R3v3r3nD May 24 '11 at 05:51
2

Check http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Fresninit.htm for some sample code.

Vikram.exe
  • 4,565
  • 3
  • 29
  • 40