`Go MAY MAR JAN
`19
`2008 2009 2012
`
`👤 ⍰ ❎
`
`
`f 🐦
`▾ About this capture
`
`12/10/2019
`
`https://en.wikipedia.org/wiki/Network_socket
`
`284 captures
`2 May 2008 - 3 Dec 2019
`
`Internet socket
`
`From Wikipedia, the free encyclopedia
` (Redirected from Network socket)
`
`In computer networking, an Internet socket (or commonly, a network socket or socket) is the endpoint of 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 (the communication
`service type) 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 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.
`
`Contents
`
`1 Socket pairs
`2 Socket types
`3 Socket states and the client-server model
`4 Implementation issues
`5 Socket support in network equipment
`6 See also
`7 Notes
`
`https://web.archive.org/web/20090319005346/https://en.wikipedia.org/wiki/Network_socket
`
`1/4
`
`1
`
`APPLE 1016
`
`
`
`12/10/2019
`8 External links
`https://en.wikipedia.org/wiki/Network_socket
`
`284 captures
`2 May 2008 - 3 Dec 2019
`Socket pairs
`
`Internet socket - Wikipedia, the free encyclopedia
`Go MAY MAR JAN
`19
`2008 2009 2012
`
`👤 ⍰ ❎
`
`
`f 🐦
`▾ About this capture
`
`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).[4]
`
`There are also non-Internet sockets, implemented over other transport protocols, such as Systems Network Architecture
`(SNA).[5] See also Unix domain sockets (UDS), for internal inter-process communication.
`Socket states and the client-server model
`
`Computer processes that provide application services are called servers, and create sockets on start up that are in listening
`state. These sockets are waiting from initiatives from client programs. For a listening TCP socket, the remote address
`presented by netstat may be denoted 0.0.0.0 and the remote port number 0.
`
`A TCP server may serve several clients concurrently, by creating a child process for each client and establishing a TCP
`connection between the child process and the client. Unique dedicated sockets are created for each connection. These are
`in established state, when a socket-to-socket virtual connection or virtual circuit (VC), also known as a TCP session, is
`established with the remote socket, providing a duplex byte stream.
`
`Other possible TCP socket states presented by the netstat command are Syn-sent, Syn-Recv, Fin-wait1, Fin-wait2,
`Time-wait, Close-wait and Closed which relate to various start up and shutdown steps.[6]
`
`A server may create several concurrently established TCP sockets with the same local port number and local IP address,
`each mapped to its own server-child process, serving its own client process. They are treated as different sockets by the
`operating system, since the remote socket address (the client IP address and/or port number) are different, i.e. since they
`have different socket pair tuples.
`
`A UDP socket cannot be in an established state, since UDP is connectionless. Therefore, netstat does not show the state
`of a UDP socket. A UDP server does not create new child processes for every concurrently served client, but the same
`process handles incoming data packets from all remote clients sequentially through the same socket. This implies that
`UDP sockets are not identified by the remote address, but only by the local address, although each message has an
`associated remote address.
`Implementation issues
`
`https://web.archive.org/web/20090319005346/https://en.wikipedia.org/wiki/Network_socket
`
`2/4
`
`2
`
`
`
`Internet socket - Wikipedia, the free encyclopedia
`12/10/2019
`Sockets are usually implemented by an API library such as Berkeley sockets, first introduced in 1983. Most
`👤 ⍰ ❎
`Go MAY MAR JAN
`https://en.wikipedia.org/wiki/Network_socket
`19
`
`
`implementations are based on Berkeley sockets, for example Winsock introduced 1991. Other socket API
`f 🐦
`284 captures
`implementations exist, such as the STREAMS-based Transport Layer Interface (TLI).
`2008 2009 2012
`2 May 2008 - 3 Dec 2019
`▾ About this capture
`Development of application programs that utilize this API is called socket programming or network programming.
`
`These are examples of functions or methods typically provided by the API library:
`
`socket() creates a new socket of a certain socket type, identified by an integer number, and allocates system
`resources to it.
`bind() is typically used on the server side, and associates a socket with a socket address structure, i.e. a specified
`local port number and IP address.
`listen() is used on the server side, and causes a bound TCP socket to enter listening state.
`connect() is used on the client side, and assigns a free local port number to a socket. In case of a TCP socket, it
`causes an attempt to establish a new TCP connection.
`accept() is used on the server side. It accepts a received incoming attempt to create a new TCP connection from
`the remote client, and creates a new socket associated with the socket address pair of this connection.
`send() and recv(), or write() and read(), or recvfrom() and sendto(), are used for sending and receiving data
`to/from a remote socket.
`close() causes the system to release resources allocated to a socket. In case of TCP, the connection is terminated.
`Socket support in network equipment
`
`Network equipment such as routers and switches traditionally do not deal with the socket identifiers of the routed or
`switched data. However, stateful network firewalls and Network Address Translation proxy servers automatically keep
`track of all active socket pairs, UDP as well as TCP, based on certain time-out settings. Also in fair queuing, layer 3
`switching and Quality of Service support in routers, packet flows may be identified by extracting information about the
`socket pairs.
`
`Raw sockets are typically available in network equipment, and used for routing protocols such as IGMP and OSPF, and
`in ICMP.
`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
`Notes
`
`1. ^ Cisco Networking Academy Program, CCNA 1 and 2 Companion Guide Revised Third Edition, P.480, ISBN 1-58713-150-1
`2. ^ [1] (https://web.archive.org/web/20090319005346/http://books.google.com/books?
`id=ptSC4LpwGA0C&pg=PA52&dq=socket+pair+tuple&lr=&hl=sv)
`3. ^ [2] (https://web.archive.org/web/20090319005346/http://books.google.com/books?id=lyY-
`7VEo9j8C&pg=PA52&dq=socket+pair&lr=&hl=sv)
`4. ^ Raw IP Networking FAQ (https://web.archive.org/web/20090319005346/http://www.faqs.org/faqs/internet/tcp-ip/raw-ip-faq/)
`5. ^ http://www-306.ibm.com/software/network/commserver/library/publications/csaix_60/dzgl1m61.htm
`6. ^ linux - netstat (8)
`(https://web.archive.org/web/20090319005346/http://ibgwww.colorado.edu/~lessem/psyc5112/usail/man/linux/netstat.8.html)
`
`https://web.archive.org/web/20090319005346/https://en.wikipedia.org/wiki/Network_socket
`
`3/4
`
`3
`
`
`
`12/10/2019
`
`https://en.wikipedia.org/wiki/Network_socket
`
`Internet socket - Wikipedia, the free encyclopedia
`External links
`👤 ⍰ ❎
`Go MAY MAR JAN
`19
`
`
`f 🐦
`284 captures
`Client/Server Programming with TCP/IP Sockets
`2008 2009 2012
`2 May 2008 - 3 Dec 2019
`▾ About this capture
`(https://web.archive.org/web/20090319005346/http://devmentor.org/articles/network/Socket%20Programming.pdf)
`TCP/IP Socket Programming in VB.NET (https://web.archive.org/web/20090319005346/http://vb.net-
`informations.com/communications/vb.net_socket_programming.htm)
`Beej's Guide to Network Programming (https://web.archive.org/web/20090319005346/http://beej.us/guide/bgnet/)
`qDecoder's C/C++ socket API
`(https://web.archive.org/web/20090319005346/http://www.qdecoder.org/goto/qSocket.html) — opensource library
`
`Retrieved from "http://en.wikipedia.org/wiki/Internet_socket"
`Categories: Inter-process communication | TCP/IP
`
`This page was last modified on 18 March 2009, at 18:29.
`All text is available under the terms of the GNU Free Documentation License. (See Copyrights for details.)
`Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a U.S. registered 501(c)(3) tax-
`deductible nonprofit charity.
`
`https://web.archive.org/web/20090319005346/https://en.wikipedia.org/wiki/Network_socket
`
`4/4
`
`4
`
`