> Usual way of handling connection reset when you do only read is to
> give all data available and then return 0, indicating EOF. Or some
> OSes (HPUX if I'm not mistaken) gives you all data available and
> then ECONNRESET. But not other way around...
>
> Connection reset effectively means that TCP's reliable data transport
> has been completely compromised, and therefore any attempt to move
> data across that socket should immediately indicate an error.
>
> What I am also trying to say is that when one says "all the data
> available", the rest of the connection has in effect dropped all
> meaning to that phrase, you no longer know what "all the data" is
> and between two different reset occurances "all the data" will be
> different so why would you want to read any of it at all?
I need to read all data BEFORE reset occurs. The problem is that I get EPIPE
before I get the data recieved before the reset.
Just live example.
I have a connection to PostgreSQL database. And for some reason that connection
was reset by database server. This can happend due to enumerous number of
errors.
Before close the connection server wrote the reason to it. The problem is that
in the case
of Linux I will not get this data unless I will provide some special handling
for this (just ignore SIGPIPE
from recv). This is not the case on other OSes.
I also can not understand whether such behavoir compatible with POSIX specs or
not?
As far as I can remember recv can not return EPIPE in any case. At least
there's no any
mention about this in man pages, info, and other docs I have.
--
Sincerely Yours,
Denis Perchine
----------------------------------
E-Mail: dyp@xxxxxxxxxxxx
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------
|