[nanomsg] Re: can server send reply to client without request innanomsg request-reply mode?

  • From: "Dan Liu" <139250065@xxxxxx>
  • To: "nanomsg" <nanomsg@xxxxxxxxxxxxx>
  • Date: Fri, 26 Feb 2016 20:39:05 +0800

If I use nanomsg bus model, all clients connect to one server's url, can 
clients send message to server, and server can send message to client? client 
doesn't send message to other client.


daniel




------------------ Original ------------------
From:  "Jan Bramkamp";<crest@xxxxxxxxx>;
Date:  Fri, Feb 26, 2016 06:08 PM
To:  "nanomsg"<nanomsg@xxxxxxxxxxxxx>; 

Subject:  [nanomsg] Re: can server send reply to client without request 
innanomsg request-reply mode?





On 26/02/16 09:06, Dan Liu wrote:

In fact I need the below communication model:
1. one server and some clients, client has server address, and server
don't known client address, client connect to server first;
2. any client can send message to the server at anytime, the server can
send reply to this client, or don't reply;
3. the server can broadcast message to all clients at anytime

There is no one nanomsg socket type to implement all of this over on 
nanomsg socket.

Your first constraint implies that the client initiates TCP connection. 
Once the connection is established nanomsg no longer cares who initiated 
the connection.

Your second requirement is well suited to the NN_REP/NN_REQ socket types.

I would use a NN_PUB socket on the server and have client connect to it 
with a NN_SUB socket.

Other related posts:

  • » [nanomsg] Re: can server send reply to client without request innanomsg request-reply mode? - Dan Liu