For efciency reasons standard io streams are buffered

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: separated from the other bytes by a period. For example, is the dotted-decimal representation of the address 0x8002c2f2. You can use the Linux HOSTNAME command to determine the dotted-decimal address of your own host: linux> hostname -i Internet programs convert back and forth between IP addresses and dotted-decimal strings using the inet aton and inet ntoa functions: #include <arpa/inet.h> int inet aton(const char *cp, struct in addr *inp); returns: 1 if OK, 0 on error char *inet ntoa(struct in addr in); returns: pointer to a dotted-decimal string The inet aton function converts a dotted-decimal string (cp) to an IP address in network byte order (inp). Similarly, the inet ntoa function converts an IP address in network byte order to its corresponding dotted-decimal string. Notice that a call to inet aton passes a pointer to a structure, while a call to inet ntoa passes the structure itself. Aside: What do ntoa and aton mean? The "n" denotes network representation. The "a" denotes application representat...
View Full Document

Ask a homework question - tutors are online