Macintosh Development |
[Home]
[About Us]
[People]
[Information Systems]
[Kerberos for Macintosh]
[Applications]
[Miscellaneous Documentation]
DNS and Service Functions |
struct hostent * gethostbyname (const char *hostname);
Given the hostname in
hostname
,gethostbyname()
uses DNS to return astruct hostent
structure. Note that this operation may block and should be cancelled using AbortAllDNSOperations().Note that you should copy out the contents of this structure since it is internal to the library.
struct hostent * gethostbyaddr (const void *addr, size_t len, int family);
Given the IP address in
addr
,gethostbyaddr()
uses DNS to return ahostent
structure. Note thataddr
is astruct sockaddr_in *
.Note that you should copy out the contents of the returned structure since it is internal to the library.
int gethostname (char *name, size_t namelen);
Gets the local hostname and puts it in the buffer
name
, truncated tonamelen
.namelen
should be the size of the buffer.Returns 0 on success, -1 on error. If you get an error, call
GetMITLibError()
to find out the error code.struct hostent * gethostaddr ();
gethostaddr()
uses DNS to return astruct hostent
structure for the local host. In a configuration such as NAT where DNS servers fail to answer for the local IP address, only the h_addr array of the returned structure is filled out and the hostname is left as an empty string. Note that this operation may block and should be cancelled using AbortAllDNSOperations().Note that you should copy out the contents of the returned structure since it is internal to the library.
struct servent * getservent (void);
getservent()
reads the next entry of the services database in Internet Config. The services database in IC is the equivalent of /etc/services on Unix machines.A connection to Internet Config is opened, if necessary.
void endservent (void);
Closes the connection to Internet Config.
struct servent * getservbyname (const char *servname, const char *protname);
getservbyname()
searches the services database in Internet Config from the beginning and finds the first entry for which the service name specified byservname
matches thes_name
member and the protocol name specified byprotname
matches thes_proto
member. Ifprotoname
is NULL, any value of thes_proto
member will be matched.A connection to Internet Config is opened, if necessary.
struct servent * getservbyport (int port, const char *protname);
getservbyport()
function searches the InternetConfig services database from the beginning and finds the first entry for which the port specified byport
matches thes_port
member and the protocol name specified byprotname
matches the s_proto member. Ifprotname
is NULL, any value of thes_proto
member will be matched. Theport
argument must be in network byte order.A connection to Internet Config is opened, if necessary.
Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/19 20:49:22 $
Last modified by $Author: smcguire $