| 14.3 | Here is just the for loop: for ( ; ; ) { if ( (n = Recv(sockfd, recvline, MAXLINE, MSG_PEEK)) == 0) break; /* server closed connection */ Ioctl(sockfd, FIONREAD, &npend); printf("%d bytes from PEEK, %d bytes pending\n", n, npend); n = Read(sockfd, recvline, MAXLINE); recvline[n] = 0; /* null terminate */ Fputs(recvline, stdout ); } |
| 14.4 | The data is still output because falling off the end of the main function is the same as returning from this function, and the main function is called by the C startup routine as follows : exit(main(argc, argv)); Hence, exit is called, plus the standard I/O cleanup routine is called. |