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

Andreas Schultz <>
Mon Apr 2 01:56:46 CEST 2012


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????

So, how do I force a gen_tcp socket so flush it's send queue
before closing it?


Dipl. Inform.
Andreas Schultz

phone: +49-391-819099-224
mobil: +49-170-2226073

------------------ managed broadband access ------------------

Travelping GmbH               phone:           +49-391-8190990
Roentgenstr. 13               fax:           +49-391-819099299
D-39108 Magdeburg             email:       
GERMANY                       web:   http://www.travelping.com

Company Registration: HRB21276 Handelsregistergericht Chemnitz
Geschaeftsfuehrer: Holger Winkelmann | VAT ID No.: DE236673780

More information about the erlang-questions mailing list