Полезная информация

CGI Programming on the World Wide Web

Previous Chapter 10
Gateways to Internet Information Servers

10.2 What Are Sockets?

Most companies these days have a telephone switchboard that acts as a gateway for calls coming in and going out. A socket can be likened to a telephone switchboard. If you want to connect to a remote host, you need to first create a socket through which the communications occur. This is similar to dialing "9" to go through the switchboard to the outside world.

Similarly, if you want to create a server that accepts connections from remote (or local) hosts, you need to set up a socket that "listens" periodically for connections. The socket is identified on the Internet by the host's IP address and the "port" that it listens on. Once a connection is established, a new socket is created to handle this connection, so that the original socket can go back and listen for more connections. The switchboard works in the same manner: as it handles outside phone calls, it routes them to the appropriate extension and goes back to accept more calls.

Previous Home Next
Overview Book Index Socket I/O in Perl

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell