MIT Information Systems

Macintosh Development

[Home] [About Us] [People] [Information Systems]
[Kerberos for Macintosh] [Applications] [Miscellaneous Documentation]


Sockets Utility Functions
int inet_pton (int family, const char *str, void *addr);

Converts a presentation format IP address to its numeric format. addr should be a struct in_addr*.

const char * inet_ntop (int family, const void *addr, char *str, size_t len);

Converts a numeric format IP address to its presentation format. addr should be a struct in_addr*.

int inet_aton (const char *str, struct in_addr *addr);

Converts an IP address in dotted string notation to a 32 bit IPv4 address. The previous corresponding routines (inet_pton and inet_ntop) are more general than these routines and are preferred in new applications.

Note: Function returns 1 on sucess and 0 on failure.

char *inet_ntoa (struct in_addr addr);

Converts a 32 bit IPv4 address into an IP address in dotted string notation.

in_addr_t inet_addr (const char *str);

Converts an IP address in dotted string notation to a 32 bit IPv4 address.

Byte-order conversion routines:

The following routines convert between network and host byte-ordering. These functions are empty macros on current Macintosh machines but should not be omitted for compatibility.

long ntohl (long);

Converts a long in network byte order to host byte order.

long htonl (long);

Converts a long in host byte order to network byte order.

short ntohs (short);

Converts a short in network byte order to host byte order.

short htons (short);

Converts a long in host byte order to network byte order.


Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/19 20:49:29 $
Last modified by $Author: smcguire $