Network - (Internet) (Socket|Endpoint)
Table of Contents
1 - About
socket is defined to be the unique identification to or from which information is transmitted in the network.
network socket is an unique identifier of a network connection between a server (local machine) and a client (remote machine).
This connection is implemented by a software (not hardware) by creating a network interface.
A socket is therefore an endpoint of an inter-process communication flow across a computer network.
Socket communications are nowadays bidirectional (full duplex) (With Tcp sure, udp ???)
2 - Articles Related
3 - Id
An socket on a operating system level is characterized by a unique combination of the following:
- Local socket address
- Protocol: A transport protocol (e.g., TCP, UDP, raw IP, or others). TCP port 53 and UDP port 53 are consequently different, distinct sockets.
4 - Address
In the standard Internet protocols TCP and UDP, a socket address is the combination of
5 - Type
There are several Internet socket types available:
- Datagram sockets, also known as connectionless sockets
- 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 made accessible to the application.
There are also non-Internet sockets, implemented over other transport protocols, such as:
- Systems Network Architecture (SNA).
- Unix domain sockets (UDS), for internal inter-process communication.
6 - State
Listening: Computer processes that provide application services are called as servers, and create sockets on start up that are in listening state. These sockets are waiting for initiatives from client programs. See TCP Listening state
The operating system forwards the payload of incoming IP packets to the corresponding application by extracting the socket address information from the IP and transport protocol headers and stripping the headers from the application data.
7 - Management
7.1 - List
The output of netstat showing a
socket Id with its state
7.2 - Count
8 - Language
- Java: For IPC, you could also use ObjectOutputStream and ObjectInputStream connected to network sockets and exchange Java objects directly between the two programs. Or you could design your own protocol.