Re: Checking dirty buffers state of a filehandle (socket) asynchroniously

From: Shachar Shemesh (linux-il_at_nonexisting.hamakor.org.il)
Date: Sat 10 Jul 2004 - 01:18:54 IDT


Ori Idan wrote:

> Shachar Shemesh wrote:
>
>> Hi all,
>>
>> There are two ways of closing a TCP socket. One is to use "close",
>> and the other is to use "shutdown". The later allows half-closed
>> sockets (i.e. - one side is closed, the other still open), which is a
>> bonus. However, the info page for shutdown states that closing the
>> write part (i.e. - saying you won't send any more data) will discard
>> any unsent data. This is a problem when using asynchronous mode. The
>> only workaround that pops to mind is to use fsync, which is blocking
>> and thus unsuitable.
>>
>> Anyone have any idea how to solve this problem? I need an
>> asynchronous way of knowing when it is ok to call "shutdown" without
>> losing information sent to the socket.
>>
>> Shachar
>>
> I haven't seen anything about throwing the data, as much as I know,
> close on the write side will
> send any unsent data and then close.
>
> --
> Ori Idan
>
The info pages.

Do "info libc". Scroll down to "Function index". Search for "shutdown".

It has a pretty detailed description of "close" sending all pending
data, and then says:

> `1'
> Stop trying to transmit data from this socket. Discard any
> data waiting to be sent. Stop looking for acknowledgement of
> data already sent; don't retransmit it if it is lost.

I read that to say data will be discarded. If anyone else thinks
otherwise, please let me know.

             Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/
=================================================================
To unsubscribe, send mail to linux-il-request_at_linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request_at_linux.org.il


This archive was generated by hypermail 2.1.7 : Sat 10 Jul 2004 - 01:31:42 IDT