/* server for inet stream demo */ /* cmd format: istr */ #include #include #include #include #include #define TRUE 1 #define MAXLINE 256 /* this program creates a socket and then begin an infinite loop. Each time * through the loop, it accepts a connection, prints out messages from it, * and then ask for reply message from the user. * When the connection breaks, or a termination messgage come through, the * program accepts a new connection. */ getline(s, lim) char s[]; int lim; { int c, i; for (i=0; i%s\n", buf); } /* send back reply */ if (write(msgsock, "ack", 3) < 0) perror("writing on stream socket"); } while (rval != 0); close(msgsock); } while (TRUE); }