What Is a Socket?

A socket is a communication channel abstraction that enables unrelated processes to exchange data locally and across networks. A single socket is one endpoint of a full-duplex (two-way) communication channel. This means that data can be transmitted and received simultaneously. From an application program perspective, a socket is a resource allocated by the operating system, similar to a file handle. It is represented by an unsigned integer called a socket descriptor. A pair of sockets is used to communicate between processes on a single workstation or different workstations. Each socket of the pair is used by its own process to send and receive data with the other socket.

When a socket is created, it is associated with a particular protocol stack (called the protocol family) and socket type within that family. Communication can occur only between sockets that use the same socket type within the same protocol family.


[Back: Sockets Background]
[Next: Socket Facilities]