Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: how detect vdr has closed socket in c++?



On Mon, 16 Feb 2004, Guido Fiala wrote:

>As to allow to set a small SVDRP-timeout without kvdr loosing a command - how
>to detect if vdr has closed the socket?
>
>I tried to check errno after calling write(), but this helps just after the
>second write()-operation on the socket and then it's too late.
>Some other way i missed?
>
>I ask, because many programs like to use SVDRP at once and i like to make kvdr
>intelligent enough to reconnect silently and fast without loosing an action.

Why not always close the socket to VDR when you are done with your
commands, and then reopen when you need a new connection? That way you
always know the state of the socket.

Maybe select()/poll() could help you otherwise? When you get notified that
you have incoming data available but 0 bytes were read the remote party
has closed the socket.

-- 
   Kids! Bringing about Armageddon can be dangerous. Do not attempt it in
   your home.
                             -- Terry Pratchett & Neil Gaiman, Good Omens


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index