MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


neon API reference                             NEADRESOLVE(3)



NAME
     neaddrresolve,       neaddrresult,        neaddrfirst,
     neaddrnext,  neaddrerror, neaddrdestroy - functions to
     resolve hostnames to addresses

SYNOPSIS
     #include 


     nesockaddr *neaddrresolve (const char *hostname,
                                    int flags);

     int neaddrresult (const nesockaddr *addr);

     const neinetaddr *neaddrfirst (nesockaddr *addr);

     const neinetaddr *neaddrnext (nesockaddr *addr);

     char *neaddrerror (const nesockaddr *addr, char *buffer,
                          sizet bufsiz);

     void neaddrdestroy (nesockaddr *addr);


DESCRIPTION
     The neaddrresolve function resolves  the  given  hostname,
     returning  an  nesockaddr  object representing the address
     (or addresses)  associated  with  the  hostname.  The  flags
     parameter is currently unused, and must be passed as 0.


     The hostname passed to neaddrresolve can be a DNS hostname
     (e.g.  "www.example.com")  or  an  IPv4  dotted  quad  (e.g.
     "192.0.34.72"); or, on systems which support IPv6,  an  IPv6
     hex  address,  which  may  be  enclosed  in  brackets,  e.g.
     "[::1]".


     To determine whether the hostname was successfully resolved,
     the  neaddrresult function is used, which returns non-zero
     if  an  error  occurred.  If  an  error   did   occur,   the
     neaddrerror  function can be used, which will copy the er-
     ror string into a given buffer (of size bufsiz).


     The functions neaddrfirst and neaddrnext are used to re-
     trieve the Internet addresses associated with an address ob-
     ject which has been successfully resolved. neaddrfirst re-
     turns  the  first address; neaddrnext returns the next ad-
     dress  after  the  most  recent  call  to  neaddrnext   or
     neaddrfirst,  or  NUL if there are no more addresses. The
     neinetaddr pointer returned  by  these  functions  can  be



neon 0.25.5       Last change: 20 January 2006                  1






neon API reference                             NEADRESOLVE(3)



     passed to nesockconnect to connect a socket.


     After the address object has been used, it  should  be  des-
     troyed using neaddrdestroy.


RETURN VALUE
     neaddrresolve returns a pointer to an address object,  and
     never NUL. neaddrerror returns the buffer parameter .


EXAMPLES
     The code below prints out the set  of  addresses  associated
     with the hostname www.google.com.

     nesockaddr *addr;
     char buf[256];

     addr = neaddrresolve("www.google.com", 0);
     if (neaddrresult(addr)) {
         printf("Could not resolve www.google.com: %s\n",
                neaddrerror(addr, buf, sizeof buf));
     } else {
         const neinetaddr *ia;
         printf("www.google.com:");
         for (ia = neaddrfirst(addr); ia != NUL; ia = neaddrnext(addr)) {
             printf(" %s", neiaddrprint(ia, buf, sizeof buf));
         }
         putchar('\n');
     }
     neaddrdestroy(addr);



SEE ALSO
     neiaddrprint(3)


AUTHOR
     Joe Orton .

ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     box; cbp-1  cbp-1 l  l .  ATRIBUTE TYPE ATRIBUTE VALUE =
     Availability   SUNWneon = Interface Stability Volatile

NOTES
     Source for Neon is available on http:/opensolaris.org.




neon 0.25.5       Last change: 20 January 2006                  2






neon API reference                             NEADRESOLVE(3)



ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:

     
       ATRIBUTE TYPE     ATRIBUTE VALUE
    
     Availability         SUNWneon       
    
     Interface Stability  Volatile       
    

NOTES
     Source for Neon is available on http:/opensolaris.org.









































neon 0.25.5       Last change: 20 January 2006                  3



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™