Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick

sockets and close/shutdown/RST packets

Dear Lazyweb,

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 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 which are behind Alteons don't handle the RST packets well.

*braced for cluestick beating*

Educated me. Thanks!
Tags: lazyweb, perlbal, tech
  • Post a new comment


    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.