netdev
[Top] [All Lists]

Re: PROBLEM: a local TCP socket close does not trigger a poll on the oth

To: kuznet@xxxxxxxxxxxxx
Subject: Re: PROBLEM: a local TCP socket close does not trigger a poll on the other end
From: "Bernard MAUDRY" <support@xxxxxxxxxxxxx>
Date: Tue, 13 Mar 2001 15:37:51 +0100
Cc: netdev@xxxxxxxxxxx
In-reply-to: <200103121740.UAA08751@xxxxxxxxxxxxx>
References: <3AACAF5A.4528.238EFA68@localhost> from "Bernard MAUDRY" at Mar 12, 1 11:13:30 am
Sender: owner-netdev@xxxxxxxxxxx
Hello!

Thanks for your reply.

> > This is not fair at all, because the socket is informed that the other
> > end has closed, so it is possible to trigger the poll.
> 
> It is triggered. You masked the event. POLLIN.
> It is normal _maskable_ event, not an error and not an out of band data.
But POLLIN indicates available input, and a close of the other end does not 
mean available input, POLLHUP should be a reasonable choice for this 
purpose but, unfortunately, it is not maskable (why ???).
The use of POLLIN is very misleading. I will try to find a way to deal with it 
as
it appears that I have no other choice.

> > Writing successfully to a socket when the other end is closed
> 
> Write will fail in the case, if other end happened to be fully closed.
Write succeeds in this case, I tested it, and this is the original symptom of 
my 
close detection problem.

> Seems, you think that tcp is a psychic. Alas, this poor guy is not a
> psychic and can distingusih close and half close only actively or if it is
> implied by application level protocol. See? You _must_ write something to
> detect death of other end or you must close actively yourself.
The call I do to poll was intended to be an active detection of the close of 
the 
other end, and it seems that socket library does not provide any direct mean 
to achieve this goal.
I don't think that tcp is a psychic, just that the socket library hides the tcp 
driver knowledge of the socket state. I wonder which system call can be used 
to get the precise state of the socket.


Thanks for your help.

Best regards.

Bernard.





+--------------------------------------+
|  Bernard MAUDRY                      |
|  Top Graph'X Customer Support        |
|  10, allee de la mare Jacob          |
|  91290 La Norville                   |
|  FRANCE                              |
|  Tel: (33) 1 69 26 97 88             |
|  Fax: (33) 1 69 26 97 89             |
|  email: support@xxxxxxxxxxxxx        |
+--------------------------------------+

<Prev in Thread] Current Thread [Next in Thread>