Create Documentation Section
<Meta-HTML> provides an extremely convenient path for creating a TCP/IP server which will listen on a particular port, and handle line-based commands. Typically, an <b>mhc</b> script is used to start the server process -- it loads the <code>serverfuncs</code> module, creates a server process, binds <code>*standard-input*</code> and <code>*standard-output</code> to the specified port, and waits for connections. When a connection is received, the server process forks and executes the function that you have specified to run. Upon exit from that function, the connection is closed. The libraries that are provided in the <code>modules/serverfunc-examples</code> tagsets directory do most of the work for implementing a complete server -- you need only to write the commands which implement the specific functionality that you require.
The type of server that is implemented by the
code expect to interact in an ASCII based conversation mode; each request from the client is a single line of ASCII text, and your server is expected to produce a response (which can be multiple lines, or a single line, or anything that your protocol implements). The code in
implement a few commands for you already, including
. You implement new commands by simply writing a function whose name is
is the exact string that the client should send to invoke the command. The convenience functions
write and read newline terminated lines of text to and from the client respectively. If you are interested in writing a TCP/IP based server, we would suggest that you read the source code to the
library, and peruse the examples.
Reference Manual V2.0
Copyright © 1995, 1998,
Brian J. Fox
Found a bug? Send mail to