T
HE
M
ETA
-
HTML
L
ANGUAGE
R
EFERENCE
M
ANUAL
[
TOC
]
Create Documentation Section
Section Name:
Search Keywords:
Short Description:
<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.
Long Description:
The type of server that is implemented by the
tagsets/server.mhtml
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
tagsets/server.mhtml
implement a few commands for you already, including
quit
,
help
, and
login
. You implement new commands by simply writing a function whose name is
COMMAND::
function-name
, where
function-name
is the exact string that the client should send to invoke the command. The convenience functions
and
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
tagsets/server.mhtml
library, and peruse the examples.
The
META-HTML
Reference Manual V2.0
Copyright © 1995, 1998,
Brian J. Fox
Found a bug? Send mail to
bug-manual@metahtml.org