HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual page 108

Bsd sockets interface programmer’s guide
Hide thumbs Also See for Rp3440-4 - 9000 - 0 MB RAM:
Table of Contents

Advertisement

Using Internet Datagram Sockets
Example Using Datagram Sockets
if (recv (s, &reqaddr, sizeof(struct in_addr), 0) == -1) {
if (errno == EINTR) {
} else {
}
alarm(0);
if (reqaddr.s_addr == ADDRNOTFOUND) {
} else {
}
}
108
/* Alarm went off & aborted the receive.
* Need to retry the request if we have
* not already exceeded the retry limit.
*/
if (—retry) {
goto again;
} else {
printf("Unable to get response from");
printf(" %s after %d attempts.\n",
exit(1);
}
perror(argv[0]);
fprintf(stderr, "%s: unable to receive response\n",
exit(1);
}
/* Print out response. */
printf("Host %s unknown by nameserver %s.\n", argv[2],
exit(1);
printf("Address for %s is %s.\n", argv[2],
inet_ntoa(reqaddr));
argv[1], RETRIES);
argv[0]);
argv[1]);
Chapter 4

Advertisement

Table of Contents
loading

Table of Contents