Does ZeroMQ provide multiple server sockets?

The built-in socket API returns on accept() new socket descriptor that is bound to a specific remote socket. This is good because I can create a stream, transfer a socket and establish a point-to-point connection, or better, a streaming connection over the Internet. And this is exactly what I want: one stream from the client must be connected to the given stream on the server. Therefore, I do not need a work pool or loadbalancing, not even asynchronous work. Server threads keep history. ZeroMQ seems great, but as I understand it, it does not split sockets into accept.

Is there any way to establish such a synchronous streaming connection with ZerMQ?

+4
source share
2 answers

You ask how to replicate a specific solution (transferring a socket to a stream) to a wider problem (how to write scalable servers).

The "one thread per socket" design works in only one template, which is a request-response, for example. HTTP While really large volumes are used for data distribution (publication-subscription) or task distribution (pipeline). Model 1 to 1 does not fit.

This is a common mistake when you learn a new tool to ask, โ€œHow does this tool do what my old tools do,โ€ but you wonโ€™t get such good results. Instead, take the time to find out how this tool works, and then use this knowledge to rethink your problems and the best solutions for them.

+5
source

I thought Zmq was handling this multi-user connection for you; I prefer to create a streaming connection by processing the connection in a stream callback function. This means that my main zmq connection is created in a separate thread; which can perform separate connection control in streams.

0
source

Source: https://habr.com/ru/post/1447975/


All Articles