[][src]Function nng::forwarder

pub fn forwarder(s1: RawSocket, s2: RawSocket) -> Result<()>

Forwards messages from socket s1 to socket s2 and vice versa.

This function is used to create forwarders, which can be used to create complex network topologies to provide for improved horizontal scalability, reliability, and isolation. The provided sockets must have protocols that are compatible with each other. For example, if s1 is a sub socket then s2 must be a pub socket, or if s1 is a bus socket then s2 must be a bus socket as well.

Note that some protocols have a maximum time-to-live to protect against forwarding loops and especially amplification loops. In these cases, the default limit (usually 8), ensures that messages will self-terminate when they have passed through too many forwarders, protecting the network from unlimited message amplification that can arise through misconfiguration. This is controlled by the MaxTtl option.

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