|[ Up (Contents) ]||Page Last Updated: 13 April 1998|
This appendix describes the programs listen.c. and backtalk.c. Listen.c is a simple program that listens at a TCP/IP port and prints to the display any characters received at the port. Thus, listen can be used to observe the data that Web browsers send when making an HTTP request. Similar to listen, backtalk listens at a TCP/IP port and prints to the display any characters received at the port. However, backtalk also lets the user type characters (enter data) at the display, such that these characters are sent on to the remote program that is talking to that port. Thus, backtalk can act like a simpleminded HTTP server--or rather, the user and backtalk can act like a simpleminded server, since the user has to type, by hand, the data to be returned to the browser. With backtalk, CTRL-D marks the end of a transmission without terminating the program, so you must end your typed message with this character. For both backtalk and listen, CTRL-C ends the transmission and kills the program.
To run either program, simply type the program name at the command prompt. Listen (or backtalk) then prints the port number it is listening at, and goes silent. Here is a typical example (the typed command is shown in boldface):prompt%> listen listening on 2055At this point, any data sent to port 2055 on this computer will be printed on the screen just below the string listening on 2055. For example, if the preceding command were executed on the machine www.testing.org, then a browser could be "pointed" to the running listen program simply by accessing the URLwww.testing.org:2055/test/pathso that the browser contacts the machine www.testing.org at port 2055.With backtalk, any characters typed to the screen by the user are sent to the remote client process attached to this port. The program is terminated by typing CTRL-C.
The source code is available from this Web site, at:
backtalk.c and listen.c.
|The HTML 4.0 Sourcebook||© 1995-1998 by Ian S. Graham|