# Sockets

Socket is the interface between two processes for the purpose of communication. Each socket has a **specific address**. This address is composed of an **IP address and a port number**. Sockets are generally employed in **client server applications**.

### **Types of Sockets**

There are two types of Sockets:

1. **Datagram Socket:** This is a type of network which has **connection less point** for sending and receiving packets. It is similar to mailbox. The letters (data) posted into the box are collected and delivered (transmitted) to a letterbox (receiving socket).
2. **Stream Socket:** In Computer operating system, a stream socket is type of **inter-process communications socket** or **network socket** which provides a **connection-oriented**, **sequenced**, and **unique flow of data** without record boundaries with well-defined mechanisms for creating and destroying connections and for detecting errors. It is similar to phone. A connection is established between the phones (two ends) and a conversation (transfer of data) takes place.
