I wrote this utility when I was investigating how tcp⁄ip and socket calls worked.

At the time I was working on a Unix pre-Windows system which displayed output on the screen using ascii terminal control characters. The system was very primitive and there were no good debuggers so I wanted to add printf statements ("poor man's debugging") to the code. I did not want these statements to interfere with the formatted screen so I devised a scheme called Remote Printf.

Remote printf works like this:

The program being debugged is the client. When a debugging printf statement is needed the routine remotePrintf (or remotePuts, etc.) is called. The prototype for remotePrintf is identical to the regular printf statement: a format string followed by a variable number of arguments.

In another window, or perhaps on another machine, the remoteprintf server is running. It is listening on a known socket. When the client calls remoteprintf, a message is written to that socket containing the remoteprintf output.

The server receives that message and displays it in its own window, thereby not interfering with the client window.

As I mentioned above, this program was really written so I could investigate how tcp⁄ip and sockets worked. As such, the following documents in excruciating detail how the program works, both for the reader, and for myself as a reminder.

Note: In the code there are several references to the symbol WIN32. The code does not work on Windows (it does work on a Macintosh). I am in the process of fixing it up to do so.