Internet socket
From Wikipedia, the free encyclopedia
An Internet socket (or commonly, a socket or network socket), is a communication end-point unique to a machine communicating on an Internet Protocol-based network, such as the Internet. (See RFC 147 for the original definition of socket as it relates to the ARPA network in 1971.)
An Internet socket is composed of the following:
- Protocol (TCP, UDP, raw IP)
- Local IP address
- Local port
- Remote IP address
- Remote port
The remote address can be either any valid IP address, or 0.0.0.0 for listening sockets and 255.255.255.255 for broadcasting sockets.
Operating systems associate sockets with a running process or processes (which use the socket to send and receive data over the network), and a transport protocol (i.e. TCP or UDP) with which the process(es) communicate to the remote host.
Usually sockets are implemented over TCP but this is not required. They can be implemented over any transport protocol, such as SNA [1]. The concept of a socket is an entity that implements an API, regardless of the implementation.
Two widely used Internet socket types are,
1. Datagram Sockets use UDP (User Datagram Protocol) for transmission. UDP is an unreliable, connectionless protocol.
2. Stream Sockets use TCP (Transmission Control Protocol), which is a reliable, connection-oriented protocol. TCP treats communications as a continuous stream of characters.
In contrast with the use of TCP connections directly, using sockets makes a distinction between client and server, and it is able to implement a queue of clients over a given server socket. Sockets usually are implemented by a library (as Berkeley sockets or Winsock).
Modern, Internet-enabled operating systems generally provide an implementation of the Berkeley Sockets API or Berkeley Sockets Layer, first introduced in 1983. Other socket API implementations exist, such as the STREAMS-based Transport Layer Interface (TLI).
By CiscoTM definition, "The combination of an IP address and a port number is referred to as a socket." P.480, ISBN 1-58713-150-1
[edit] See also
- Internet Protocol
- Internet protocol suite
- Packet
- Raw socket
- TCP and UDP port numbers
- Unix domain socket for a similar abstraction for local communication
- Named pipe for one-way communication