D. J. Bernstein
Internet publication
FTP: File Transfer Protocol

The QUIT verb

A QUIT request asks the server to close the connection:
     220 Features: a .
     221 Bye.
QUIT parameters are prohibited. Some servers will reject any QUIT request with a nonempty parameter.

If the server accepts the QUIT request (required code 221), it then closes the connection without reading further requests. The server also stops listening for data connections and drops any data connections already accepted.

Clients closing connections

The client can simply close the connection without sending QUIT. This saves time and memory for both the client and the server.

There are a few broken TCP implementations, such as MacTCP 2.0.6, that fail to acknowledge TCP FINs after a local close. If the client is running on such a host, it shouldn't close the connection until after it sends QUIT and sees the server close the connection; otherwise the server will waste time repeatedly transmitting the FIN until it times out.

Servers closing connections

Servers close connections without QUIT in some circumstances, for example because of a crash. High-quality clients treat closed connections as temporary rejection.

A high-quality server will close the connection if it runs out of memory or other local resources, or if the client is inactive for a while. Many servers will send a response with code 421 before closing the connection; after the client sends its next request, it will receive the 421 response and treat it as temporary rejection. Other servers do not bother sending 421.