Lookup has been hacked to act in server mode, where it listens for
connections on a socket. Compile with -DSERVER_CONFIG.  This allows
programs to access it for searching.

It is not very well done. There can only be one client at a time (i.e.
while working with one client, it doesn't listen for others).  Also, the
server shouldn't be a separately-compiled program, but just an option.
Some day.

As it is, you probably want to rename the 'lookup' binary to something like
'lookup.srv' for the server.

When starting the server, -verbose means that the server should be a bit
verbose about what commands it is getting, while '-port ####' allows you to
override the port number defined in config.h. No RC file is read when running
as a server.

The client sends commands to the server.  As with regular 'lookup', most
command lines are search patterns (although you may append ",1" etc. for
accessing multiple files). As with regular 'lookup', non-search commands
are required to be a prefixed by a space (or whatever the command-prefix
character is).

***************
** Note that the lines sent by the client should NOT have a newline (unless
** you want the newline to be part of the pattern).
***************

There are some special commands that the client can send:

  "-- -exit- --"  Causes the server to exit.
		I.e.
			print SERVER "-- -exit- --";
		(note lack of newline)

  "--continuous--"
	If the first command by a given client, the server will not drop
	the connection after the first command has been answered. This
	allows multiple question/answer sessions during one connection.
	In this case, the server signals it is done with one answer by
	sending "--done--\n" and then waiting for another command.

	The server will respond with "--ok--\n" when the --continuous--
	command has been recognized.
	
  "--bye--"
	For a --continuous-- connection, closes the connection for the
	current client; server continues to wait for another client.


------------------------------------------------

There is a small perl test program "test.pl" just so you can get it
working.  It requires my network.pl library, a (perhaps old) copy of which
is included here. The latest version is always at
	http://www.wg.omron.co.jp/~jfriedl/perl/

jfriedl@omron.co.jp

