Server framework

The framework in net/server.cls was written to ease the implementation of various internet protocol servers (smtp, pop3, ...).

Servers for specific a protocol have to derive from the baseclass server. The latter is then configured by

What Required Meaning
server:port + Symbolic or numeric specification of the tcp port the server shall listen on for new connections. Examples: '1234', 'pop3'.
server:cmdMap + Defines the mapping between commands and the methods handling them. Upper and lower case will not be distinguished in command names. The methods will be called with 3 arguments: connection id, command to handle and the complete line as sent by the client. Use server:SetCmdMap to define it in a convenient way.
server:GreetPeer - Called after initialization of a new connection. Is responsible for sending a server and connection specific greeting message to the new client.
server:HandleUnknownCmd - Called if the received command was not found in the server:cmdMap. Gets the same arguments as a normal handler method. Should send a server specific error message to the client. The standard implementation just does a shutdown of the connection.
server:InitializeNewConnection - Defaults to an empty method. Is called to perform server specific initialization of a new connection. The general initialization is already done. One argument, the connection id.
server:CloseConnection - Defaults to an empty method. Is called to perform server specific cleanup of a connection. The general cleanup is already done. One argument, the connection id.

An example of its usage can be found in net/pop3/server.cls


Generated by AutoDoc 2.4 at 09/14/2000, invoked by Andreas Kupries