Internet socket

In computer networking, an Internet socket (or commonly, a network socket or socket) is the endpoint of a bidirectional communication flow across an Internet Protocol-based computer network, such as the Internet. Internet sockets (in plural) are an application programming interface (API) in an operating system, used for in inter-process communication. Internet sockets constitute a mechanism for delivering incoming data packets to the appropriate application process or thread, based on a combination of local and remote IP addresses and port numbers. Each socket is mapped by the operational system to a communicating application process or thread.

A socket address is the combination of an IP address (the location of the computer) and a port (which is mapped to the application program process) into a single identity, much like one end of a telephone connection is between a phone number and a particular extension line at that location.

An Internet socket is characterized by a unique combination of the following:

* Protocol (TCP, UDP or raw IP). Consequently, TCP port 53 is not the same socket as UDP port 53. * Local socket address (Local IP address and port number) * Remote socket address (Only for established TCP sockets. As discussed in the Client-Server section below, this is necessary since a TCP server may serve several clients concurrently. The server creates one socket for each client, and these sockets share the same local socket address.)

The operating system forwards incoming IP packets to the corresponding application or service process by extracting the socket address information from the IP and transport protocol headers.

Within the operating system and the application that created a socket, the socket is referred to by a unique integer number called socket identifier or socket number.

In Internet standards, in many textbooks as well as in this article, the term “socket” refers to an entity that is uniquely identified by the socket number. In other textbooks[1], the socket term refers to a local socket address, i.e. a “combination of an IP address and a port number”. In the original definition of socket given in RFC 147 as it was related to the ARPA network in 1971, a socket was “specified as a 32 bit number with even sockets identifying receiving sockets and odd sockets identifying sending sockets.” Today, however, sockets are bidirectional.

On Unix-like and Windows NT based operating systems the netstat command line tool can list all currently listening and established sockets and related information.

Socket pairs

Communicating local and remote sockets are called socket pairs. Each socket pair is described by a unique 4-tuple struct consisting of source and destination IP addresses and port numbers, i.e. of local and remote socket addresses. [2] [3]. As seen in the discussion below, in the TCP case, each unique socket pair 4-tuple is assigned a socket number, while in the UDP case, each unique local socket address is assigned a socket number.

Socket types There are several Internet socket types:

* Datagram sockets, also known as connectionless sockets, which use User Datagram Protocol (UDP) * Stream sockets, also known as connection-oriented sockets, which use Transmission Control Protocol (TCP) or Stream Control Transmission Protocol (SCTP). * Raw sockets (or Raw IP sockets), typically available in routers and other network equipment. Here the transport layer is bypassed, and the packet headers are not stripped off, but are accessible to the application. Application examples are Internet Control Message Protocol (ICMP, best known for the Ping suboperation), Internet Group Management Protocol (IGMP), and Open Shortest Path First (OSPF).

There are also non-Internet sockets, implemented over other transport protocols, such as Systems Network Architecture (SNA). See also Unix domain sockets (UDS), for internal inter-process communication.

About the Author:

Subscribe / Share

Article by Professional editor working for Flexible Exhaust Tubing.

Authors bio is coming up shortly. Read 1 articles by Professional editor working for Flexible Exhaust Tubing.
It's very calm over here, why not leave a comment?

Leave a Reply