Sunday, September 11, 2011

Need for Out-of-Band Data

Understanding the Need for Out-of-Band Data

Although you can immediately appreciate the benefits of bypassing the lineup in a bank, you would also recognize that using a gun for this purpose is considered rather antisocial. A TCP stream is
normally expected to send data bytes in perfect sequence and so to send them out of sequence seems counter to what streams are all about. Why then provide out-of-band socket facilities?

As you have probably realized, there are times when data simply becomes "urgent" in some way. A stream socket can have a large amount of data queued waiting to be transmitted to the network. At the remote end, there can be a large amount of data received, which has yet to be read by the application. If the sending client program now has a reason to cancel the request that has already been written to the server, it might want to urgently indicate a cancel request to the server. Failing to issue a cancel request to the remote server unnecessarily wastes the server's resources.

You might answer this design problem by saying that the socket can be prematurely closed, or information can be transmitted on an additional socket connection. Both of these solutions are less
than ideal for different reasons:
  • Shutting down a socket does not permit recovery if more communication is to be continued. 
  • The addition of an extra connection can be quite expensive when hundreds or thousands of users are pounding on your server. 
  • Company firewall restrictions make it even more desirable to perform all your networking needs within the one socket connection.

Practical examples of programs that use of out-of-band data are the telnet, rlogin, and ftp commands. The first two programs send the interrupt character as urgent data to the remote end. This allows the remote end to flush all unprocessed input and to discard with any unsent terminal output. This facilitates a quick interrupt of a running process, which might have been spewing oodles of output to your screen. The ftp command uses out -of-band data to abort a file transfer.

No comments:

Post a Comment