添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
苦闷的黄豆  ·  python非法字符 - CSDN文库·  9 月前    · 
害羞的饭卡  ·  JavaScript Number 对象 ...·  1 年前    · 
Can I ask another question?

I use the zmq_poll() in REQ-REP pattern

When the client send a Req and then wait for res from the server ,

but the Res can not reach the client in time for some reasons(for example,
handle the Req for a long time),

then the client wait timeout, now how to handle the socket?

If I call the zmq_close() and next time when send a Req I build another
socket and connect server again,

what happen after the server send the delayed Res? What will server do in
ZMQ with the former connection to the client?

Will the server release the related resource assigned to the former
connection?
Post by liyongyan
Can I ask another question?
I use the zmq_poll() in REQ-REP pattern
When the client send a Req and then wait for res from the server ,
but the Res can not reach the client in time for some reasons(for example, handle the Req for a long time),
then the client wait timeout, now how to handle the socket?
If I call the zmq_close() and next time when send a Req I build another socket and connect server again,
what happen after the server send the delayed Res? What will server do in ZMQ with the former connection to the client?
Will the server release the related resource assigned to the former connection?
Timeouts are not handled by 0mq. You must create the logic in your application to deal with these issues yourself.

This may be covered in the user guide. Check http://zguide.zeromq.org/chapter:1

If not, here is how I would suggest you try to handle this in your application.

1. Use a XREP socket on your server. The XRE? sockets do *not* enforce a strict send/recv ordering like the REQ/REP sockets.

2. After you call zmq_close() on the original REQ socket that timed out, make sure that the *new* REQ socket you build has the same identity as the old one. I *think* 0mq will honor that (use zmq_setsockopt(IDENTITY, x) to set it) for routing a delayed response back to you. Again, your application will need to know how to handle a delayed response.

3. When you call zmq_close() on a socket now, any messages in progress will be dropped. 0mq releases all resources associated with the now dead socket.

cr
Thank you very much!

But what I ask is, simply to say, if must use TCP REQ/REP pattern,

the client send a REQ and then close socket and don't connect the server
again,

the server receive the REQ and handle it, send the REP, but now the
client do not exist,

will the server's zmq resend the REP or release the resource associated with
the tcp connection?
Post by liyongyan
Can I ask another question?
I use the zmq_poll() in REQ-REP pattern
When the client send a Req and then wait for res from the server ,
but the Res can not reach the client in time for some reasons(for example,
handle the Req for a long time),
then the client wait timeout, now how to handle the socket?
If I call the zmq_close() and next time when send a Req I build another
socket and connect server again,
what happen after the server send the delayed Res? What will server do in
ZMQ with the former connection to the client?
Will the server release the related resource assigned to the former connection?
Timeouts are not handled by 0mq. You must create the logic in your
application to deal with these issues yourself.
This may be covered in the user guide. Check
http://zguide.zeromq.org/chapter:1
If not, here is how I would suggest you try to handle this in your application.
1. Use a XREP socket on your server. The XRE? sockets do *not* enforce a
strict send/recv ordering like the REQ/REP sockets.
2. After you call zmq_close() on the original REQ socket that timed out,
make sure that the *new* REQ socket you build has the same identity as the
old one. I *think* 0mq will honor that (use zmq_setsockopt(IDENTITY, x) to
set it) for routing a delayed response back to you. Again, your application
will need to know how to handle a delayed response.
3. When you call zmq_close() on a socket now, any messages in progress will
be dropped. 0mq releases all resources associated with the now dead socket.
cr
_______________________________________________
zeromq-dev mailing list
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
If the client closes its socket, the server will drop the reply, I think.
You won't get an error in the server.
Post by yy l
Thank you very much!
But what I ask is, simply to say, if must use TCP REQ/REP pattern,
the client send a REQ and then close socket and don't connect the server
again,
the server receive the REQ and handle it, send the REP, but now the
client do not exist,
will the server's zmq resend the REP or release the resource associated with
the tcp connection?
Post by liyongyan
Can I ask another question?
I use the zmq_poll() in REQ-REP pattern
When the client send a Req and then wait for res from the server ,
but the Res can not reach the client in time for some reasons(for example,
handle the Req for a long time),
then the client wait timeout, now how to handle the socket?
If I call the zmq_close() and next time when send a Req I build another
socket and connect server again,
what happen after the server send the delayed Res? What will server do in
ZMQ with the former connection to the client?
Will the server release the related resource assigned to the former connection?
Timeouts are not handled by 0mq. You must create the logic in your
application to deal with these issues yourself.
This may be covered in the user guide. Check
http://zguide.zeromq.org/chapter:1
If not, here is how I would suggest you try to handle this in your application.
1. Use a XREP socket on your server. The XRE? sockets do *not* enforce a
strict send/recv ordering like the REQ/REP sockets.
2. After you call zmq_close() on the original REQ socket that timed out,
make sure that the *new* REQ socket you build has the same identity as the
old one. I *think* 0mq will honor that (use zmq_setsockopt(IDENTITY, x) to
set it) for routing a delayed response back to you. Again, your application
will need to know how to handle a delayed response.
3. When you call zmq_close() on a socket now, any messages in progress will
be dropped. 0mq releases all resources associated with the now dead socket.
cr
_______________________________________________
zeromq-dev mailing list
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Hi Liyong,

If you can make requests idempotent (i.e. you can execute the same one
more than once, safely) then you don't have to close the socket.

As Chuck says, use an async XREQ socket and re-send the request. The
server can use REP. These socket types are explained in Chapter 3 of
the user guide.

-Pieter
Post by liyongyan
Can I ask another question?
I use the zmq_poll() in REQ-REP pattern
When the client send a Req and then wait for res from the server ,
but the Res can not reach the client in time for some reasons(for example,
handle the Req for a long time),
then the client wait timeout, now how to handle the socket?
If I call the zmq_close()  and  next time when send a Req I build another
socket and connect server again,
what happen after the server send the delayed Res? What will server do in
ZMQ with the former connection to the client?
Will the server release the related resource assigned to the former
connection?
_______________________________________________
zeromq-dev mailing list
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
--
-
Pieter Hintjens
iMatix - www.imatix.com