Skip to content
Tom Barbette edited this page Oct 3, 2018 · 2 revisions

ChatterSocket Element Documentation

NAME

ChatterSocket — Click element; reports chatter messages to connected sockets

SYNOPSIS

ChatterSocket("TCP", PORTNUMBER [, KEYWORDS])
ChatterSocket("UNIX", FILENAME [, KEYWORDS])

Ports: none
Drivers: userlevel

DESCRIPTION

Opens a chatter socket that allows other user-level programs to receive copies of router chatter traffic. Depending on its configuration string, ChatterSocket will listen on TCP port PORTNUMBER, or on a UNIX-domain socket named FILENAME.

The "server" (that is, the ChatterSocket element) simply echoes any messages generated by the router configuration to any existing "clients". The server does not read any data from its clients.

When a connection is opened, ChatterSocket responds by stating its protocol version number with a line like "Click::ChatterSocket/1.0\r\n". The current version number is 1.0.

ChatterSocket broadcasts copies of messages generated by the default ErrorHandler or the click_chatter function. Most elements report messages or run-time errors using one of these mechanisms.

If a client falls more than 500,000 bytes behind, ChatterSocket automatically closes its connection.

ChatterSocket supports hot-swapping, meaning you can change configurations without interrupting existing clients. The hot-swap will succeed only if the old ChatterSocket and the new ChatterSocket have the same element name, and the same socket type, port/filename, and chatter channel parameters. Additionally, the new ChatterSocket must have RETRIES set to 1 or more, since the old ChatterSocket has already bound the relevant socket.

Keyword arguments are:

  • CHANNEL — Text word. The socket outputs messages sent to this chatter channel. Default is the default channel, which corresponds to click_chatter().

    Channels help you organize extensive debugging output. For example, you could send extremely verbose messages to a `verbose' channel, then only connect to that channel when you want verbosity.

    To send messages to a particular channel, you should fetch the ErrorHandler object corresponding to that channel, using the Router member function Router::chatter_channel(const String &channel_name).

  • QUIET_CHANNEL — Boolean. Messages sent to a non-default channel are not normally printed on standard error. If QUIET_CHANNEL is false, however, the channel's messages do go to standard error, along with chatter messages. Default is true.

  • GREETING — Boolean. Determines whether the Click::ChatterSocket/1.0 greeting is sent. Default is true.

  • RETRIES — Integer. If greater than 0, ChatterSocket won't immediately fail when it can't open its socket. Instead, it will attempt to open the socket once a second until it succeeds, or until RETRIES unsuccessful attempts (after which it will stop the router). Default is 0.

  • RETRY_WARNINGS — Boolean. If true, ChatterSocket will print warning messages every time it fails to open a socket. If false, it will print messages only on the final failure. Default is true.

EXAMPLES

  ChatterSocket(unix, /tmp/clicksocket);

SEE ALSO

ControlSocket

Generated by click-elem2man from ../elements/userlevel/chattersocket.hh:7 on 2018/10/03.

Clone this wiki locally