[erlang-questions] Difference in 'close' for gen_tcp recv vs. active
Wed Apr 9 14:56:20 CEST 2014
On 09.04.2014 02:49, Fred Hebert wrote:
> The difference here is that we have a peer that actively closes the
Does the peer use close(s) or shutdown(s, SHUT_WR) to "close" the
> and the packets are readable and detected as far as tcpdumps
> go. Things like FINs or RSTs. They're making it to our host,
It makes a difference here, whether these are FINs or RSTs. Just
receiving a FIN from the peer will not stop the OS from accepting for
and sending data to the peer.
> just entirely ignored unless we're willing to read undefined amounts of
> data from the buffer for the stack to apparently get access to them.
If the peer uses shutdown() only you have no choice with standard
sockets. You probably don't want to start using pcap.
> 99.99% of the time that's gonna be 0 bytes because of HTTP clients' rare
> tendency to pipeline requests.
> I'm just extremely annoyed having to figure out a way to add in a buffer
> to carry possibly unlimited amounts of data to read from a socket so it
> can figure out if a FIN or RST was sent recently, but I guess that's the
> way we'll have to do it.
> Oh well.
More information about the erlang-questions