/* * chat_send.c - read a line of user input & send it to remote process * until the user types control-D (end of file) * (based on echoclient.c and ideas in echo.c echoserver.i) */ #include "csapp.h" void chat_send(int connfd){ char buf[MAXLINE]; while (Fgets(buf, MAXLINE, stdin) != NULL) { // user input from terminal Rio_writen(connfd, buf, strlen(buf)); // put to remote connection } }