[erlang-questions] how to flush a gen_tcp socket on close?

Matthias Lang <>
Mon Apr 2 14:52:39 CEST 2012

On Monday, April 02, Andreas Schultz wrote:

> gen_tcp sockets do buffer sends internaly. It seems, when
> calling close on them, the buffered data is not flushed out,
> but simply discarded .
> I was expecting that a close on an socket with outstanding
> send data would block until that data has been send, but that
> seems not to happen. In fact, that might be a bug????

I would also expect a socket to send all data. So your description
of what actually happens is surprising.

Can you provide a minimal but complete code which demonstrates what
you're seeing?


More information about the erlang-questions mailing list