Windows sockets+ Network
Winsock
is the standard for socket under Windows
.
winsock programming is divided into UDP "Windows sockets + UDP" , TCP "Windows socket + TCP" programming. The Windows socket is built on the network, and UDP programming uses the User Datagram Protocol (User Datagram Protocol, UDP), TCP programming with Transmission Control Protocol (Transmission Control protocol,tcp). Udp. Different characteristics of TCP. Adapt to different application needs. The  UDP,TCP protocol was established in Internet Protocol (Internet PROTOCOL,IP) based on.
1. Internet Protocol (Internet protocol,ip):
IP protocol capabilities: the transmission of data between interconnected networks. That is, transfer from one IP host to another IP host.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbg92zwnvzgvszxnz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "/>
IP protocol is the transfer data protocol between host and host. Can only complete the host-to-host datagram transmission.
the IP datagram format is as follows:
IP Header: Information about the IP datagram, including the source IP. IP data such as destination IP. These IP data are like addresses on a letter, guaranteeing that the datagram is transmitted to the destination IP host. IP data: transmitted data. IP protocol is an unreliable protocol and may drop packets. Errors, etc., does not guarantee that the data must be delivered to the target host.
2. Subscriber Datagram Protocol (user Datagram Protocol, UDP): UDP is located above the IP protocol. Using IP as the underlying transport protocol, UDP encapsulates its own UDP datagram in the IP data transmission.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbg92zwnvzgvszxnz/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast "/>
UDP Header: Includes data such as source port, destination port, and so on.
the port guarantees that the data can be accurately transferred to the specified process. UDP Data: the transmitted data. UDP is based on IP protocol, IP protocol is unreliable protocol. UDP itself does not guarantee reliable measures, so UDP protocol is unreliable. The UDP protocol is suitable for data reliability. Sequential delivery of non-required programs, UDP can provide faster, smaller consumption of transport services.
3. Transmission Control Protocol (transmission-protocol,tcp): with the UDP protocol, TCP is also located above the IP protocol. Encapsulates a TCP datagram within the IP data transfer.
TCP Header: Includes source port as compared to UDP,TCP. At the same time as the target port, TCP also includes information such as serial number, confirmation number, which is used to confirm that the data is being delivered completely, and TCP is the reason for the reliable protocol. TCP Data: the transmitted data. TCP is based on unreliable protocol IP. But TCP uses a variety of mechanisms to ensure that the data is orderly. Reliable delivery. TCP is used more for applications that require high data security, such as the web. e-mail and so on.
4. Extensions: here is simply an introduction to IP. Udp,tcp the relationship between the protocols. And the characteristics of these agreements cannot be exhaustive. Readers are interested, can read computer network related books, "Computer network", "UNIX network Programming" and so can solve your confusion.
"Windows socket+ip+udp+tcp" Network Fundamentals