6.1 The Basics of Services

6.1 The Basics of Services

TCP services are among the easiest to understand because they are simple, uninterrupted data streams. For example, you can talk directly to a Web server on TCP port 80 to get an idea of how data comes across the connection. Run the following command to connect to a Web server:

telnet www.nytimes.com 80

You should get a response like this:

Trying some address...
Connected to www.nytimes.com.
Escape character is '^]'.

Now type this:

GET /

Press ENTER twice. The server should send a bunch of HTML text as a response, and then terminate the connection.

There are two important lessons here:

  • The remote host has a Web server process listening on TCP port 80.

  • telnet was the client that initiated the connection.

Note?

telnet is a program originally meant to enable logins to remote hosts. Although the non-Kerberos telnet remote login server is completely insecure (as you will learn later), the telnet client is useful for debugging remote services. telnet does not work with UDP or any other transport layer other than TCP. See Section 6.5.3 for information on netcat, a powerful general-purpose network client.