Finita la conversione dei listati in file separati. Passato anche alla nuova
[gapil.git] / listati / ServEcho.c
diff --git a/listati/ServEcho.c b/listati/ServEcho.c
new file mode 100644 (file)
index 0000000..917c7c4
--- /dev/null
@@ -0,0 +1,10 @@
+void ServEcho(int sockfd) {
+    char buffer[MAXLINE];
+    int nread, nwrite;
+    
+    /* main loop, reading 0 char means client close connection */
+    while ( (nread = read(sockfd, buffer, MAXLINE)) != 0) {
+        nwrite = FullWrite(sockfd, buffer, nread);
+    }
+    return;
+}