[nanomsg] Re: A multiple client/worker for NN_PAIR style sockets.

  • From: Alex Elsayed <eternaleye@xxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Thu, 08 Jan 2015 02:17:04 -0800

It's less that I had another thing in mind, and more that I was wondering 
about more details regarding what your actual application-level protocol is.

For instance, if the messages are infrequent, then survey might be enough 
anyway.

What are the conditions under which the server needs to send the message?
Does every client get the message a fixed number of times?
Is the server commanding the client to do something and getting a result?
Is the server querying the client about its state?
Is it just the server checking the client's update status?

I just don't have enough information to make a more detailed recommendation 
with what you've said so far.

Rohit Saboo wrote:

> Jason, goq does look quite interesting, and I'll certainly read it. I
> initially tried using a combination of NN_PUSH and NN_PULL sockets and
> they worked fine till I started running my clients on networks different
> from the server. I haven't looked into your implementation in detail yet,
> but the way I tried to implement it involved a client creating an NN_PUSH
> socket, which it would connect to a bound server-side NN_PULL socket. The
> client would also create a bound NN_PULL socket, and in the initial
> handshake, it would send the address of this socket to the server. The
> server would then create a new NN_PUSH socket and connect it to the
> client's bound NN_PULL socket. Now if the client and server are on
> different machines, and given that I cannot setup any sort of port
> forwarding on the gateways in the client networks, what address should the
> client send to the server in the initial handshake for the server to
> connect back to?
> 
> Alex, the SURVEY socket does indeed look like it will work for the
> otherwise tricky case of server asking questions to a client because most
> of the requests initiated from the server-side are typically small. In
> some ways, I could also use NN_BUS in a similar manner, and it would cover
> the other cases, too, and that way I would neither have to start tcpmux
> nor would I have to keep track of several more ports with associated
> routing issues in the server configuration.
> 
> However, what is the other option you were about to suggest for when the
> requests initiated from the server are large? It is quite likely, I may
> have to support something of that sort in the future.
> 
> 
> Rohit
> 
> On Wed, Jan 7, 2015 at 6:58 PM, Jason E. Aten
> <j.e.aten@xxxxxxxxx> wrote:
> 
>> Rohit, I would invite you to check out my Goq project, which does 90% of
>> what you describe. It is built on go and nanomsg using push pull. A
>> dynamic number of workers can be utilized, and requests are heartbeated
>> and re-issued in case of worker failure. If nothing else it may show you
>> one example that is close to what you describe.
>>
>> https://github.com/glycerine/goq
>>
>> Best,
>> Jason
>>
>> > On Jan 7, 2015, at 1:08 PM, Rohit Saboo
>> > <saboo.rohit@xxxxxxxxx> wrote:
>> >
>> > Hi all,
>> >
>> > I need to create a system where there are several clients that can
>> communicate simultaneously with a server. For simplicity, we can assume
>> that the server has a constant number of workers.
>> >
>> > The clients can send messages to the servers and the workers may
>> > respond
>> to these messages and/or send messages by itself possibly expecting
>> responses. In other words, there's free two way communication between a
>> client and the server.
>> >
>> > Using NN_PAIR with devices results in the error "transport endpoint
>> already connected" when the second worker tries to connect to the local
>> "inproc" socket. Using a solution that creates a pair of NN_PUSH/NN_PULL
>> sockets also won't work because the client and server are on different
>> networks and providing a connection endpoint on the client for the server
>> to connect to will be tricky.
>> >
>> > Is there a way in nanomsg to have free two-way communication between
>> multiple clients and a single server?
>> >
>> > Thanks,
>> > Rohit
>> >
>>
>>



Other related posts: