user2910794
user2910794

Reputation: 21

zeromq poller combining multiple req sockets and pub

What is the correct zeromq message pattern to choose to implement server, which needs to handle 2 way communication between N-clients (client can issue requests and server can issue notification, which has to be reliable. Thus pub/sub in not going to work here)? What I did: server has REP to handle client requests, REQ to issue notification to client, SUB to get some events. client has REQ to issue requests to server, REP to receive notifications from server, SUB to get some events Then: server has polling to POOLIN over REP and SUB sockets client has polling to POOLIN over REP and SUB sockets

As soon as poll & POOLIN, REP socket calls recv, than do some processing, than send. As soon as poll & POOLIN, SUB socket calls recv.

This schema is not working reliably. If I call poll POLLIN over one REQ socket when data was sent until REQ socket got reply, schema is working, but it's a bit strange.. Am I missing something?

Upvotes: 2

Views: 1279

Answers (1)

raffian
raffian

Reputation: 32086

Do you really need blocking REQ/REP sockets? I suggest going fully asynchronous with DEALER on the client, check this:

https://stackoverflow.com/a/19417116/791406

Hope it helps,

Upvotes: 1

Related Questions