Echo

Go To Product Page

The Echo plugin is arguably the most straightforward layer imaginable—its functionality is exactly what the name suggests: it echoes back whatever data it receives. The moment any input arrives, it’s instantly transmitted back unchanged.

In fact, here’s the entire code for the plugin:

class EchoLayer: doc.Layer {
        construct(doc.PluginHost* pluginHost) {
                basetype.construct(pluginHost);
                pluginHost.m_log.attachListener(onLogRecord @ pluginHost.m_mainThreadScheduler);
        }

        void onLogRecord(
                uint64_t timestamp,
                uint_t recordCode,
                void const* p,
                size_t size
        ) {
                if (recordCode == log.StdRecordCode.Rx)
                        try transmit(p, size);
        }
}

And that’s it: a simple tool for testing, and could be your starting point for a more sophisticated testing utility.

Basic Setup

  1. In an active session, e.g. TCP Server, attach the Echo layer.

_images/echo-attach.png
  1. As packets arrive (shown in green), confirm they are then sent back out (shown in blue).

_images/echo-results.png