Table of Contents


lgwrelay - send message to logiweb server and print response


lgwrelay host port homeurl ip request


The Logiweb relay allows a user to play with a Logiweb server (c.f. logiweb(1) ) in a user friendly style using a web browser. The Logiweb relay is designed to be called from a CGI-script but may also be run as an ordinary user command provided the user is prepared to read html. For a sample CGI-script, see the EXAMPLES section.

The audience of the Logiweb relay are programmers of Logiweb clients and servers who want to play with a Logiweb server in order to learn the details of the Logiweb protocol (c.f. logiweb(7) ).

The Logiweb relay sends the given ip and request to the Logiweb server listening at the given tcp port of the given host and then prints the response to standard output. If the Logiweb relay is invoked from a CGI-script, then the pipeline comprising web browser, CGI-script, lgwrelay, and the tcp port of the Logiweb server adds syntactic sugar to the Logiweb protocol. For raw hexadecimal communication using the servers udp port use lgwping(1) instead.

The pipeline is self-documenting. Invoking lgwrelay with the empty string as request (typically by looking up something like in a web browser) gives all explanations needed.


The host to send the request to. This can be given as a domain name like or as a dotted ip like

The tcp port number to send the request to. The number is read from right to left until the first non-digit is found so that e.g. /var/www/logiweb/65535 is interpretted as 65535. In bash scripts this allows to give the port number as $0 if the name of the script ends with the port number.

Base url of local urls. As an example, the Logiweb logo is expected to be at url/doc/logiweb.png and online documentation is expected to be at url/doc. The Logiweb relay uses homeurl when generating error messages.

A string which the Logiweb relay passes uninterpreted to the Logiweb server for further processing (c.f. the EXAMPLES section). The server uses the ip for logging.

A string which the Logiweb relay passes uninterpreted to the Logiweb server for further processing (c.f. the EXAMPLES section). The server uses the request to figure out what the user wants.


Suppose lgwrelay is situated in /usr/bin/lgwrelay. Suppose the following script is situated in /var/www/logiweb/65535 with execute permissions set:

/usr/bin/lgwrelay $0 \

Further suppose the configuration files of the local web server maps http://my.domain/logiweb/server/ to /var/www/logiweb/, e.g. by having ScriptAlias /logiweb/server/ "/var/www/logiweb/" in a configuration file such as /etc/httpd/conf.d/logiweb.conf.

Under these assumptions, if you look up in your browser somewhere in the world then lgwrelay will send your IP and /xyzzy to tcp port 65535 of the Logiweb server at The response from that tcp port will be sent back to your web browser.

The REMOTE_ADDR and PATH_INFO environment variables are set by the web server when it invokes the CGI-script. See a CGI primer for details.

PATH_INFO is in quotes above for the sake of situations where PATH_INFO is the empty string.

If the server runs behind a proxy, consider replacing REMOTE_ADDR above by HTTP_X_FORWARDED_FOR. Otherwise, all requests will seem to come from the proxy.


Klaus Grue,

See Also

logiweb(1) , logiweb(7) , lgwping(1)

Table of Contents