I'm also not 100% certain that TCP will drain an unsent packet when it sees that the socket is closed before it hits the wire. I think the answer would depend on whether or not the socket was blocking or not or if the socket had been flushed before the close() call.
Mark, If the IMAP for some mail stores defers committing operations until a logout command, how does the server report the result back to the client? The client at this point has no way of recovering from the error, since it's tearing down the connection - just like an OS close() call, a LOGOUT cannot realistically fail. Larry Osterman -----Original Message----- From: Arnt Gulbrandsen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 8:53 AM To: [EMAIL PROTECTED] Subject: Re: to logout or not... DINH Viet Hoa <[EMAIL PROTECTED]> > > I find this a tough question to answer. My inclination is just to > > close > > the connection but I cannot offer much justification for that. One > > consideration is that, if you send a LOGOUT and then immediately close the > > connection, it seems likely that the server will never see the LOGOUT. > > it will see it because it is TCP (reliable) layer. It often will, TCP's reliability only goes so far. Take the case where you're using a GUI MUA on a modem-connected machine. You click the 'close' button on the MUA window and then the 'disconnect modem' button. Almost certainly, the packet containing the LOGOUT has been sent before you manage to click the 'disconnect modem' button, but if that packet is lost, the PPP connection is probably down before the retry would happen. --Arnt