Create an asynchronous device: a zero-copy forwarder that relays raw messages between two Sockets. This is the building block for brokers and proxies, such as a publisher/subscriber relay or a pair-to-pair bridge.
Details
A device runs on background threads and relays messages until it is stopped or
an error occurs. The returned 'sendAio' resolves only at that point: its
$result is an 'unresolved' logical NA while the device is running, and
otherwise the integer exit code (usually the error that caused it to stop,
such as a Socket being closed).
Both Sockets must be opened in raw mode (see socket()) and use complementary
protocols, that is the peer protocol of each must be the protocol of the other
(for example two 'pair' Sockets, or a 'pub' and a 'sub' Socket). The same
Socket may be supplied for both arguments to create a reflector.
To stop the device, use stop_aio(), or close either of the Sockets. To block
and wait for the device to stop, use call_aio().
See also
send_aio() for the structure of the returned 'sendAio'.