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)
|
|
In Perl, sockets are bidirectional filehandles:
- Filehandles with read and write capability
- Internally, implemented with C routines to
access the socket support in the operating system
- Use the object-oriented module:
Clients and servers must agree on a method of communication, including:
- A protocol (e.g. ftp or http)
- A way of signaling when a message is complete