Socket programming
A Socket is a process communication mechanism of BSD UNIX. It is also called a Socket. It describes an IP address and port and is a handle to a communication chain. Socket can be understood as the TCP/IP network API. It defines many functions or routines that programmers can use to develop applications over the TCP/IP network. Applications running on a computer usually make or respond to network requests through sockets.
socket
Socket is an intermediate software abstraction layer for communication between application layer and TCP/IP protocol family. In the design mode, Socket is actually a facade mode, it hides the complex TCP/IP protocol family behind the Socket, for users only need to call the relevant functions specified by the Socket, let the Socket to organize in line with the specified protocol data and then communicate.
TCP protocol
Transmission Control Protocol/Internet Protocol (TCP/IP) is a connection-oriented and reliable Transport layer communication Protocol based on byte streams. Because it is a connection-oriented protocol, data flows like water, causing sticky packets. UDP protocol.
The User Datagram Protocol (UDP) is a connectionless transport Protocol in the Open System Interconnection (OSI) reference model. Data can be sent and received directly without establishing a connection, which is not reliable and has no timing communication. However, UDP protocol has good real-time performance and is usually used in fields related to live video broadcasting.
- Socket is also called a Socket. Applications send or answer network requests through the Socket
- There are two common Socket types: streaming Socket and datagram Socket. Streaming Socket is a connection-oriented Socket aimed at connection-oriented TCP service applications. Datagram Socket is a connectionless Socket aimed at connectionless UDP service applications
- TCP: more reliable, connection-oriented, slower
- UDP: Not very reliable, faster