Sun Jan 14 19:53:05 EST 2001
The server has to be started first; it listens on port 5194 for the client. The client reads a line from stdin, sends it to the server, reads one line back, and prints it. The server reads a line at a time as well, echoing it with a count so the effect of multiple clients can be seen. The server quits if it reads a line that says "exit".
The plumbing here is as complicated as it gets: the server forks a child to service the incoming connection. That child in turn forks a child of its own that becomes ampl via an exec. The (child) server and ampl communicate through two pipes that are established after the (second) fork but before the exec.
Srv2.java is a threaded version of the server that starts a separate thread for each incoming client, so it can be carrying on conversations with several clients at the same time; srv.java must finish one conversation before it can begin another.
telnet www.yahoo.com 80 GET /index.html HTTP/1.0 (extra blank line)
The second Perl program also mails them to me.
The submission page is a simple form that says
<FORM> ACTION="http://campuscgi.princeton.edu/~bwk/surv1.cgi" METHOD=POST> <input name="foo"> <INPUT TYPE="submit" VALUE="Send" > </FORM>