ocean.net.server.unix.UnixConnectionHandler

Unix domain socket connection handler

The connection handler expects the client to send UTF-8 text data in the form of '\n'-separated lines. Each line starts with a command. The command is terminated with either a linebreak '\n' or a space ' '. If it is terminated with a space then the rest of the line are the arguments for the command. Whitespace at the beginning of the line, command and arguments is trimmed. Examples:

"my-cmd\n" -- command = "my-cmd", arguments = "" " my-cmd \n" -- ditto "my-cmd arg1 arg2\n" -- command = "my-cmd", arguments = "arg1 arg2" " my-cmd arg1 arg2 \n" -- ditto

Empty lines or lines containing only white space are ignored.

The constructor takes a command handler that must contain a method matching

void handle ( cstring command, cstring args,
              void delegate ( cstring response ) send_response )

where command is the name of the command (as explained above), args is everything after the command and send_response sends the response string to the client. Note that the response should end in a '\n' newline character, which is not automatically added.

Members

Classes

BasicCommandHandler
class BasicCommandHandler

Provides basic command handling functionality for unix socket commands.

UnixConnectionHandler
class UnixConnectionHandler

Provides default functionality for handling unix socket commands.

UnixSocketConnectionHandler
class UnixSocketConnectionHandler(CommandHandlerType)

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).