TCP/IP Explained

In this chapter we shall deal with some of the protocols on the periphery of the Internet Protocol suite and those enjoying less publicity. Nevertheless, many protocols in this category are important as debugging and measurement tools, or provide information or connection methods unavailable elsewhere within the suite. Some are not actually considered to be true protocols, but instead services listening on specific TCP or UDP ports and taking action(s) when connections are established or when datagrams arrive. Nevertheless these can be important, well-known applications, that provide users with a great deal of information.
RFC 862 (Std 20) specifies a simple echo service useful for debugging and measurement. The principle of any such service is to simply return any data received to the sending host in much the same way as ICMP Echo Request/Reply. Here however, the protocol defines a service compatible with TCP and UDP.
With the TCP service, the server process listens on a well-known port (TCP port 7). When a connection is established, any data received is returned to the sender intact. This then continues until the calling host terminates the connection. In the UDP implementation, the server again listens on port 7 [albeit this time UDP). Since connections are not established with UDP though, the server process listens for datagrams arriving that specify this port number as the destination port, and again returns all received data intact.
Unlike the Echo protocol described above, Discard protocol packets are...