[zeromq-dev] 0MQ 4 - how to detect closed stream socket ?

Pieter Hintjens ph at imatix.com
Thu Apr 24 12:11:30 CEST 2014


This is indeed lacking in the client side use of ZMQ_STREAM. However
most conventional TCP protocols don't return arbitrary data from the
server without a request from the client first. That is, if the server
is sending 10K bytes and the connection is broken, the client will get
nothing more until it decides the connection is "dead" and then
reconnects.

-Pieter

On Thu, Apr 24, 2014 at 3:09 AM, KIU Shueng Chuan <nixchuan at gmail.com> wrote:
> I am trying out ZMQ_STREAM and it's great that (re)-connects are handled
> asynchronously. However...
>
> Say a TCP server sends out 10000-byte messages such that multiple recv()s
> are required to get the whole message. A ZMQ_STREAM client receives 1500
> bytes and then the connection gets broken. (E.g. server gets killed and
> restarted) How would the client know to reset its message assembling state
> if it doesn't know about the disconnection?
>
>
> On Sat, Oct 12, 2013 at 11:49 PM, Pieter Hintjens <ph at imatix.com> wrote:
>>
>> Indeed... ZMQ_STREAM like all sockets will reconnect opportunistically
>> so you don't get a formal notification of a closed socket.
>>
>> On Fri, Oct 11, 2013 at 9:03 PM, Charles Remes <lists at chuckremes.com>
>> wrote:
>> > Via a timeout.
>> >
>> > On Oct 11, 2013, at 12:15 PM, itlists at schrievkrom.de wrote:
>> >
>> >> How can I detect, that the server has closed a stream client socket ?
>> >>
>> >> Marten
>> >> _______________________________________________
>> >> zeromq-dev mailing list
>> >> zeromq-dev at lists.zeromq.org
>> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> >
>> > _______________________________________________
>> > zeromq-dev mailing list
>> > zeromq-dev at lists.zeromq.org
>> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list