<div dir="ltr">2013/4/22 Marco van de Voort <span dir="ltr"><<a href="mailto:marcov@stack.nl" target="_blank">marcov@stack.nl</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">In our previous episode, Xiangrong Fang said:<br>
> I am writing a redis client in fpc and found that even when the connection<br>
> is closed by server (via redis CLIENT KILL),<br>
<br>
</div>I don't know the redis protocol is, but "CLIENT KILL" sounds like redis<br>
protocol, while you are trying to detect disconnect at socket level. And is<br>
your socket layer really connection oriented ?<br></blockquote><div><br></div><div>Yes, it is redis protocol. I can only be sure that it is TCP based. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
IOW does the remote server really actively close the socket?<br>
<br>
Maybe stracing the application during a disconnect event might yield some<br>
more information.<br></blockquote><div><br></div><div>I will study stracing if necessary. But will simple "netstat" show the status of a socket? <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> How do I tell if a socket is still connected or not?<br>
<br>
</div>Limit the timeout time (some socketoption or ioctl iirc, search the web),<br>
send something, and wait the timeout time. Then read something.<br></blockquote><div><br></div><div>I am using blocking mode, it just return immediately.<br><br></div></div></div></div>