Function nng::reflector[][src]

pub fn reflector(s1: RawSocket) -> Result<()>
Expand description

Reflects a socket’s sent messages back at itself.

The provided socket must have a protocol that is bidirectional and can peer with itself, such as a pair or bus socket. A reflector or loop-back device is created where valid messages from the socket are simply returned back to the sender.

This function does not return unless the socket encounters an error or is closed. For more information, see the NNG documentation.

Errors

In addition to returning any error that the underlying sockets can encounter, this function also has the following error conditions:

  • Closed: The socket is not open.
  • InvalidInput: The socket is not capable of sending messages to itself.
  • OutOfMemory: Insufficient memory available.