[zeromq-dev] Unreasonable behavior of a socket when connection can't be established. How to enable the blocking mode on a socket?
Jim Melton
jim at melton.space
Wed Sep 28 06:26:11 CET 2022
You generally don’t want to use ZMQ to handle TCP connections.
You want to use ZMQ to implement a variety of messaging patterns, independently of the underlying transport layer. TCP is one but several other protocols are supported.
In general, if you have ZMQ on one side, you want ZMQ on the other side. While it is technically possible to use ZMQ to handle only one side of a TCP socket, it is generally not desirable. I had occasion to do this, connecting to a piece of hardware. For a number of reasons, we ended up scrapping the ZMQ to TCP logic and just implemented a TCP connection for that device that we later bridged into our ZMQ infrastructure.
It seems like you haven’t spent the time to absorb the basic premise behind ZMQ yet. I can’t urge your strongly enough to go back and read the guide. Your confusion is common, and it is addressed in some detail (and with some humor). Trying to force ZMQ to be TCP will only frustrate you.
--
Jim Melton
> On Sep 28, 2022, at 12:04 AM, Yuri <yuri at rawbw.com> wrote:
>
> This isn't good.
>
> This means that anybody who would use ZMQ to handle TCP connections wouldn't be able to properly handle basic TCP error conditions because they don't fit into ZMQ's paradigm.
>
> Good architecture should handle things easily and with elegance. It shouldn't be so abstract that it would ignore important life situations.
>
>
> Cheers,
> Yuri
>
>
>
>
> On 9/27/22 22:25, Jim Melton wrote:
>> They aren’t reported because they aren’t “errors” in ZMQ. Because the connection can happen independently (asynchronously) from the call to to connect, and because a socket may be connected to a variety of endpoints, the TCP conditions you are concerned about are not exposed to you.
>>
>> You are asking about detecting a condition that does not exist in the ZMQ architecture.
>>
>> Now, depending on the type of socket and the options set, there might be an error in trying to send to a socket when the other end isn’t present. Or it might not. PUB sockets, for example, need never have a client connected to allow sends to succeed.
>> --
>> Jim Melton
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20220928/b32f8304/attachment.htm>
More information about the zeromq-dev
mailing list