1

I would like to implement a system where:

  • there is one server
  • there are many clients
  • the clients send requests to the server.

Obviously, the REQ/REP pattern would be the right one to use. But:

  • I want the clients to be able to send multiple requests, without waiting for the response.
  • I want the server to process multiple requests in parallel.

So as far as I know, the correct pattern for this would be DEALER/ROUTER, is this correct? Or is there a better approach?

The client should be able to send many requests and should receive the corresponding responses asynchronously.

Thanks in advance

user2297996
  • 1,382
  • 3
  • 18
  • 28

1 Answers1

3

Yes, the clients would be DEALER sockets, and the server would be the ROUTER socket, and it should work the way you require. This will work fine as long as you only have a single server. If you add more servers, the DEALER sockets will send requests to each one in a round-robin fashion, which may or may not be what you're after. They won't allow you to select a specific server if they are connected to multiple servers. As long as you keep this in mind, there are other strategies to manage this, but for now you won't need to worry about it.

Jason
  • 13,606
  • 2
  • 29
  • 40