<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="RIGHT: auto"><SPAN style="RIGHT: auto">Matthias,</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"> Thanks<VAR id=yui-ie-cursor></VAR> for your quick response. My client has sent messages to the server right after the connection is opened, as well as when heartbeat is received... I'm pretty sure that the server has received the message since my client has got a response from it. Everything looks to be right and according the requirement, that's why I suspect that the heartbeat machanism might not be fully working on the server side, since even though it receives data from the client it still tears down the connection. I wonder if you or anybody have been using heartbeat in C-client and has it ever worked?</SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"> The program I'm writing has been working for a few months and I'm trying to add heartbeat handling to deal with the unreliable network. </SPAN></div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto"></SPAN> </div>
<div style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px; RIGHT: auto"><SPAN style="RIGHT: auto">Best regards.</SPAN></div>
<div style="RIGHT: auto"><SPAN style="RIGHT: auto">Dawn</SPAN></div>
<div><BR></div>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV dir=ltr><FONT size=2 face=Arial>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=hr contentEditable=false readonly="true"></DIV><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Matthias Radestock <matthias@rabbitmq.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Dawn L <dawn_l2012@yahoo.com>; Discussions about RabbitMQ <rabbitmq-discuss@lists.rabbitmq.com> <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Sunday, December 2, 2012 4:39 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [rabbitmq-discuss] Is heartbeat option working in C-client?<BR></FONT></DIV><BR>Dawn,<BR><BR>On 02/12/12 08:44, Dawn L wrote:<BR>> My C-client can start to receive heartbeat message (the message has<BR>> frame_type
"AMQP_FRAME_HEARTBEAT"). However, after getting the<BR>> heartbeat messages for two times, the connection and channels opened<BR>> by my client have been abruptly closed by the server.<BR><BR>Looks like the server did not receive any frame for too long. Check the<BR>server logs to confirm thwat.<BR><BR>> From what I read in the past articals, if the client sends any kind<BR>> of message to server before the timeout, the connection shouldn't be<BR>> closed. However, this is not the case for me - I've tried to respond<BR>> with either normal messages (via normal channel), or frames with<BR>> frame type AMQP_FRAME_HEARTBEAT (via channel 0) right after the<BR>> client received the heartbead message, but the connection is still<BR>> closed by the server regardless. Is it because the heartbeat<BR>> functionality has not been fully implemented yet? Or is there any<BR>> special kind of message that should be send as response
message to<BR>> the heartbeat message?<BR><BR>Heartbeats in the sending and receiving direction are completely independent. When a heartbeat interval has been agreed then each peer is supposed to send *some* data to the other at least every heartbeat_interval. The heartbeat frames are there to fill in the time slots when no other data is being sent.<BR><BR>So you certainly shouldn't be *waiting* to receive a heartbeat before sending something since that would establish an artificial interlocking of the sending and receiving direction.<BR><BR>For more details see section 4.2.7 of the AMQP 0-9-1 spec.<BR><BR>If you think you are doing everything right and the connection is still being torn down then look at a protocol trace with wireshark. That should hopefully identify the problem.<BR><BR>Regards,<BR><BR>Matthias.<BR><BR><BR></DIV></DIV></div></body></html>