2013/4/22 Marco van de Voort <mar...@stack.nl>

> In our previous episode, Xiangrong Fang said:
> > I am writing a redis client in fpc and found that even when the
> connection
> > is closed by server (via redis CLIENT KILL),
>
> I don't know the redis protocol is, but "CLIENT KILL" sounds like redis
> protocol, while you are trying to detect disconnect at socket level. And is
> your socket layer really connection oriented ?
>

Yes, it is redis protocol.  I can only be sure that it is TCP based.


> IOW does the remote server really actively close the socket?
>
> Maybe stracing the application during a disconnect event might yield some
> more information.
>

I will study stracing if necessary. But will simple "netstat" show the
status of a socket?

>
> > How do I tell if a socket is still connected or not?
>
> Limit the timeout time (some socketoption or ioctl iirc, search the web),
> send something, and wait the timeout time.  Then read something.
>

I am using blocking mode, it just return immediately.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to