Network programming question:
I have a listening socket. Client connects to it, and I write a bunch of data to it, in chunks as it becomes writable. After I'm done writing and want to properly close the connection, what do I have to do?
a) just close the socket?
b) shutdown and close the socket?
c) wait for socket to become writable again, and (a) or (b)?
I'd thought it was just (a), but Perlbal is sending RST packets like crazy when I do that. If I put in arbitrary delays before the close, the RST packets go away, but that's really hacky and lame.
We'd never noticed this on LiveJournal.com before, because the BIG-IP sanitizes the situation to some degree, but RST packets still reach end users, and it's technically wrong. Also, other sites (like discogs.com) which are behind Alteons don't handle the RST packets well.
*braced for cluestick beating*
Educated me. Thanks!