Commentato il codice del server echo basato sulla funzione poll.
[gapil.git] / listati / ServEcho_first.c
1 void ServEcho(int sockfd) {
2     char buffer[MAXLINE];
3     int nread, nwrite;
4     char debug[MAXLINE+20];
5     /* main loop, reading 0 char means client close connection */
6     while ( (nread = read(sockfd, buffer, MAXLINE)) != 0) {
7         nwrite = FullWrite(sockfd, buffer, nread);
8         if (nwrite) {
9             PrintErr("write error");
10         }
11     }
12     return;
13 }