Socket Programming
Server algorithm
1. Initialize socket address. 2. Create socket. 3. Bind socket. 4. Listen to socket. 5. Accept socket.
Client algorithm
1. Initialize socket address. 2. Create socket. 3. Connect to the socket. 4. Close the socket. 5. Free the socket address.
Stream Socket
A type of interprocess 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.
End Point
An endpoint is a combination of an IP address and a port number.
Socket
One endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to.
TCP/IP
The Transmission Control Protocol ensures the data arrives sequentially and error-free. The Internet Protocol deals primarily with Internet routing and is not generally responsible for data integrity.
UDP
The User Datagram Protocol does not guarantee that data will arrive or arrive in order, but if it arrives, the data within the packet will be error-free. It is called "connectionless" because you don't have to maintain an open connection as you do with stream sockets and are generally used either when a TCP stack is unavailable or when a few dropped packets here and there don't mean the end of the Universe.