[erlang-questions] EPIPE and TCP sockets
Per Hedeland
per@REDACTED
Mon Oct 15 19:08:00 CEST 2007
Tony Garnock-Jones <tonyg@REDACTED> wrote:
>
>Per Hedeland wrote:
>> Hm, I don't think that's correct - AFAIK SIGPIPE/EPIPE happens only if
>> you try to write more data to a socket when the other end is considered
>> to be closed (either due to receiving FIN or RST, or due to
>> retransmission timeout).
>>
>> Closing the socket with unack'ed data normally doesn't do anything in
>> particular, the close() returns immediately but the kernel holds on to
>> the data and tries to (re)transmit it according to the standard TCP
>> logic, and you won't be told if it fails.
>
>Thanks, Per. That's useful. It tells me that TCP itself can do what I
>want, but the sockets interface isn't set up for it.
Uh, you snipped the part where I described how the sockets interface
*is* set up for it:-) (via SO_LINGER).
> I'll do something different at the application level.
That's what you generally need to do anyway, if you want to be sure that
the remote *application* received that last chunk of data you sent - and
not just that the TCP stack ack'ed it.
--Per
More information about the erlang-questions
mailing list