I don't need no stinking firewall!

William Herrin bill at herrin.us
Sun Jan 10 11:54:24 CST 2010


On Sun, Jan 10, 2010 at 12:47 PM, William Herrin <bill at herrin.us> wrote:
> Even if it does
> send an RST, most application developers aren't well enough versed in
> sockets programming to block on the shutdown and check the success
> status,

Sorry, I got that wrong. shutdown() will succeed without waiting for a
FIN or RST from the remote end. So will close(). Instead, after the
shutdown() you then have to block on read() waiting for a either 0
bytes read or an error. 0 bytes = FIN, error = RST.

Unfortunately, few sockets programmers realize that they have to do
this to catch that final possible error. They send what the expect to
send and if they don't expect to receive anything back, they shutdown
and close the socket without waiting.

Regards,
Bill Herrin

-- 
William D. Herrin ................ herrin at dirtside.com  bill at herrin.us
3005 Crane Dr. ...................... Web: <http://bill.herrin.us/>
Falls Church, VA 22042-3004




More information about the NANOG mailing list