Windows Socket + network
WinsockWindows Socket Standard.Winsock programming is divided into UDP [Windows socket + UDP] and TCP [Windows socket + TCP] programming. Windows socket is built on the basis of the network. UDP programming uses the User data Protocol (UDP), and TCP programming uses the Transmission Control Protocol (TCP ). Different Features of UDP and TCP can meet different application requirements.UDP and TCP are based on the Internet Protocol (IP.1.Internet Protocol(Internet Protocol, IP ):
The IP protocol function: transmits data between interconnected networks, that is, from one IP host to another.
The IP protocol is the data transmission protocol between the host and the host. It can only transmit data between the host and the host. The IP datagram format is as follows:
IP header: the IP address datagram information, including the source IP address, target IP address, and other IP address data. The IP address data is like the address on the mail, ensuring that the datagram is transmitted to the target IP host.IP data: transmitted data.The IP protocol is an unreliable protocol, which may cause packet loss or errors. It does not guarantee that data is delivered to the target host.
2.User Datagram Protocol(User datateprotocol, UDP):UDP is located above the IP protocol and uses IP as the underlying transmission protocol. UDP encapsulates its UDP datagram into IP data for transmission.
UDP header: contains data such as source port and target port. Port ensures that data can be accurately transmitted to the specified process.UDP data: transmitted data.UDP is based on the IP protocol, and the IP protocol is unreliable. UDP itself does not have any measures to ensure reliability, so the UDP protocol is also unreliable. UDP Protocol is applicable to programs that have no requirements for data reliability and sequential delivery. UDP can provide faster and less-consuming transmission services.
3.Transmission Control Protocol(Transmission Control Protocol, TCP):Same as UDP protocol, TCP is also located on top of the IP protocol. It encapsulates TCP datagram in IP data transmission.
TCP Header: Compared with UDP, TCP also contains data such as the source port and target port, while TCP also contains information such as the serial number and confirmation number. The data is used to confirm whether the data is completely delivered, TCP is a reliable protocol.TCP Data: transmitted data.Although TCP is built on an unreliable Protocol IP address, TCP uses multiple mechanisms to ensure orderly and reliable data delivery. TCP is mostly used for applications with high data security requirements, such as Web and email.
4. extensions:Here, we only briefly introduce the relationship between IP, UDP, and TCP Protocols, as well as the characteristics of these protocols, which cannot be comprehensive. If you are interested, you can read books related to computer networks, computer networks, and UNIX network programming.