Networking concepts

Sockets are endpoints of communication.

They can reside on the same machine, on different machines on a local area network, or on extended networks such as the Internet.

A typical application consists of two programs, each having its own socket:
  • A server:
    • Listens on its socket for requests
    • Processes them
    • Returns a result (usually)
  • A client:
    • Makes requests to the server's socket
    • Listens for responses (if any)
the client requests and the server responds

In Perl, sockets are bidirectional filehandles:

Clients and servers must agree on a method of communication, including: