nanomsg-Q&A

nn_shutdown vs nn_close

nn_shutdown closes just one endpoint and prevents that endpoint from
forming new connections.

nn_close closes the entire socket.

A socket can have many endpoints.

多个服务端支持多个客户端 nn_device

a single socket can be connected to multiple endpoints at the same time.

device framework

s = nn_socket(AF_SP_RAW, NN_REQ);
nn_bind(s, "tcp://server1:5556");
nn_bind(s, "tcp://server2:5556");
nn_bind(s, "tcp://server3:5556");

This means you get three underlying TCP connections load balanced by a single outgoing REQ socket. You can use that with a device framework to get the DEALER logic you're trying to achieve.

You can even omit it to listen on all interfaces - e.g.
tcp://:5556 will cause the server to listen on every network interface on
TCP port 5556.