|A client program connects to a server and sends an operation, and gets a result back. What happens then? Is the connection open, so that the client can send more operations? Answer the question for the protocols SMTP, FTP, HTTP, POP and IMAP. What are the pros and cons of keeping the connection open or closing it down after each operation?
The session stays open in SMTP, FTP, POP and IMAP. In traditional HTTP (version 1.0) the session is closed by the server immediately after sending the response. HTTP 1.1 allows the session to stay open, but this feature is not used very much. (One might also note that the cookie facility of HTTP can be used to give a user functionality similar to an open session, even if the session does not really stay open.) In FTP, there are two channels, one control channel which stays open until the client closes the channel, servers often close the channel after a time out. The other channel, the data channel, is opened for each file to be transformed and in most cases closed by the server after transmission of each file.
Note 1: The impression to the user may be that the session is closed immediately, with SMTP, FTP and POP, because the client is configured to automatically send a number of operations and then close the connection. But the session does stay open for several client operations, even if this is not always shown to the user.
Note 2: Even if the client takes the initative to close the connection, the actual closing is sometimes done by the server, after a command from the client asking the server to close the connection. This is for example the procedure in IMAP.
Advantange of keeping the session open:
Advantage of closing down the session:
List of exam questions