[zeromq-dev] Limit number of connections on socket

Auer, Jens jens.auer at cgi.com
Tue Mar 17 16:56:01 CET 2015


Hi,

I am looking for a way to limit the number of connections to a configurable number. Our requirement says that for one specific endpoint, only a certain number of connections should be allowed. I hoped for socket option to do that, but I could not find any. Reading the documentation, I came up with the following ideas:

-       Create a new context for the restricted endpoint and restrict the number of connections with ZMQ_MAX_SOCKETS.

-       Install a socket monitor which monitors connect/disconnect events and counts active connections. When the number is exceeded, the new connection is closed immediately

-       Install a socket monitor which monitors connect/disconnect events and counts active connections. When the number is reached, install a filter blocking every new connection until one of the connections is closed.
Are there any other ways to do that? There is no real application-level protocol so I cannot close connections on that level. The application basically accepts connections and starts to send data immediately to anybody connecting.

I would be grateful if anybody could comment on these methods. Personally, I prefer the first one because it seems to be simpler and relies only on zeroMQ defined behaviour.

Best wishes,
  Jens Auer

--
Jens Auer | CGI | Software Engineer
CGI Deutschland Ltd. & Co. KG
Rheinstraße 95 | 64295 Darmstadt | Germany
T: +49 6151 36860 154
jens.auer at cgi.com<mailto:jens.auer at cgi.com>
Unsere Pflichtangaben gemäß § 35a GmbHG / §§ 161, 125a HGB finden Sie unter de.cgi.com/pflichtangaben<http://de.cgi.com/pflichtangaben>.

CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI Group Inc. and its affiliates may be contained in this message. If you are not a recipient indicated or intended in this message (or responsible for delivery of this message to such person), or you think for any reason that this message may have been addressed to you in error, you may not use or copy or deliver this message to anyone else. In such case, you should destroy this message and are asked to notify the sender by reply e-mail.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150317/a0f7b434/attachment.htm>


More information about the zeromq-dev mailing list