Chapter 18. Internet Services

This “telephone” has too many shortcomings to be seriously considered as a means of communication. The device is inherently of no value to us.

Western Union internal memo, 1876

Introduction

Correct use of sockets is only part of writing programs that communicate over the network. Once you have a way for two programs to talk, you still need a protocol for communication. This protocol lets each party know when to talk, and it precisely defines who is responsible for which part of the service.

Common Internet protocols are listed in Table 18-1.

Table 18-1. Common Internet protocols

Protocol

Meaning

Action

FTP

File Transfer Protocol

Copying files between remote machines

telnet

 

Remote login

rsh and rcp

Remote shell and Remote copy

Remote login and remote file copying

NNTP

Network News Transfer Protocol

Reading and posting USENET news

HTTP

Hypertext Transfer Protocol

Transferring documents on the Web

SMTP

Simple Mail Transfer Protocol

Sending mail

POP3

Post Office Protocol

Reading mail

Even something as relatively simple as connecting to a remote computer requires intricate negotiations between client and server. If you had to write the Perl code to implement these protocols each time you wanted to use a network service, you’d probably end up writing a lot of buggy programs, trying to get demoted into a management position, or both.

Fortunately, Perl has modules for these protocols. Most modules implement the client side of the protocol rather than the server side. This is because ...

Get Perl Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.