Hi

A bit off topic (actuallu a lot). Has anyone out there got some C source code for doing logging to a file. I don't wish to use syslog or daemons. I know I should just write to a file with some simple code; but why reinvent the wheel.

Wayne
PS what I REALLY want is all of the following:

The objective:

I want to set up a multiplexing proxy server.

It will:

1) keep permanent connection to another server(X), reconnecting if required.
2) accept and maintain up to 60 concurrent connections from clients.
3) any query sent by a client will get passed on to the server and vice versa.
4) To achieve that, first 6 bytes of each line from a client are used to keep unique ID
5) server(X) has to retain the first 6 bytes from each query and return it back as part of the response
6) Each query from clients and response from server must be terminated by LF ( ASCII value of 10 ) character.
7) Each client is allocated a 4KB buffer, which limits the size of each query
8) Server responses also must be limited to 4KB or less.
9) Log all activity
10) Ability to shut down normally

Signals:

HUP     - close all existing client connections

USR1     - suspend writing to debug log file

USR2     - resume writing to debug log file, can also be used to re-open logfiles after rotating them

INT     - reconnect to the server

TERM/QUIT     - safe shutdown

Each line in the log files starts with the pid of the server in square brackets, followed by
a date/time stamp and the actual message.

You must use the same pid as in the logs to send signals with the kill command, e.g.

[18614] 24/12/2001 15:59:21 Proxy is now listening on port 6900, interface localhost

$ kill -HUP 18614

[18614] 24/12/2001 16:14:28 SIGHUP caught, Closing all clients




------------------------------------------------------------
FREE EMAIL for all from AUSI at http://ausi.com    Access world wide.

