1 UDP Receive principleThe UDP receiving process of the operating system is as follows: After receiving a UDP packet, after verifying that there is no error, put in a package queue, each element in the queue is a complete UDP packet. When the
Both Recv and recvfrom are used to accept data from the network. Let's take a look at their prototype:
Int Recv (Socket{Function onclick (){Function onclick (){Showtip (this)}}} "> S,Char far*{Function onclick (){Function onclick (){Showtip (this)}
Phenomenon:On a Windows 7 system, a uses a UDP socket, which calls the SendTo function to send data to a destination address B, but the destination address B does not receive data, and if a immediately calls Recvfrom to attempt to receive the data
1) To prevent redefinition, the header file inclusion sequence in Windows code is as follows:
# Include # Define win32_lean_and_mean# Include
Reference: http://blog.sina.com.cn/s/blog_658d267b0100jb2l.html
// ========================================
Source: http://www.vckbase.com/document/viewdoc? Id = 536
Windows Sockets network programming (iii) -- Windows Sockets 1.1 ProgrammingAuthor: Xiaoying, freezing point StudioI. IntroductionWindows Sockets is extended from Berkeley sockets.
Two Protocols TCP and UDPThe former can be understood as a guaranteed connection, and the latter is the pursuit of fast connections.Of course, the last point is a bit too absolute, but now do not have to boil too much, because the first socket
Applications that use the TCP/IP protocol usually use two application programming interfaces (APIS): socket and TLI (Transport Layer ). The former is sometimes called "Berkeley socket", indicating that it has evolved from the Berkeley edition. The
Here, the thread model refers to the thread model design related to Winsock.
Some problems in the design process of this software involve Winsock. In order to design the thread model well, we must understand the internal working mechanism of socket.
1 Concept DescriptionBefore interpreting, there are a few concepts to be explained:
User space and kernel space
Process switching
Blocking of processes
File descriptor
Cache IO
1.1 User space and kernel spaceNow that
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.