Sockets

Almost every desktop computer in existence now implements a protocol whereby numbered ports can be opened to the outside world. Most of the low-numbered ports have consistent assignments. For instance, port 80 is generally used to accept Web browser connections, and 25 and 110 are used for e-mail delivery and retrieval, respectively. Microsoft Windows does the bulk of its networking on ports 137, 138, and 139.

Note

On Unix, look at the /etc/services file for an extensive list of network services and the port numbers associated with them.

A port is useless until it is associated with a socket, since a port is hardly anything more than a number, and a socket is a real IO object. Sockets are the means by which your Ruby scripts talk to ...

Get Sams Teach Yourself Ruby in 21 Days now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.