Talking about the "Network" programming in online games ???? In recent times, there are always many people who have completed the port model. Many times, I am very depressed, why will everyone choose to use the completion port? Or many times they actually use Windows as a network game server platform, and also open a bunch of online game cases using a Windows platform. Some brothers have always argued that "Windows? 2003? Server is very fierce, very efficient", the correctness of this sentence is not discussed, first speaks how much WINDOWS? 2003? SERVER? Reducing costs are not equal to making more money. Put a free and efficient Linux is not available, the article will give money to buy expensive? And the performance is still low? Don't worry, rest assured, I am right, let's take a look at some of IBM's researchers compare the performance of Linux and Windows. Let's take a look at the speed comparison of thread creation: ???? Of course, maybe you will say, now use the thread pool, you have created a thread when you start, then you will use it directly. Well, let's take a look at the speed of the socket. ???? Don't have a red neck, this is just a simple test, but there is a small news that Windows will increase a lot when it is transmitted for the 127.0.0.1 address of the local area, then is it? Let's take a look at the test results below: ???? Among them, the wire with the fork is to the transmission speed in the case of 127.0.0.1 this address, it is true that the small road is true, and the windows2000 is This is really a lot when the address is transmitted. So what shortcomings are there in Windows and Linux? Windows has a feature in the thread, called Thread? Creation? DECAY, what does it mean? That is, as the running time is getting longer, the speed of the thread is created and the speed of the thread is created, and the speed of the thread will be different. This is why a Linux server can restart a few years. The Windows operating system is not. I don't deny Windows. I just want to say here, the Windows system is due to the Built-IN? GUI it provides, causing the kernel to handle each system call, more or less will have some loss. ???? It seems that there is a bit of a job, these and the network have nothing to do, then we will look back to the network programming, first we will discuss the fundamental of the network, what is it? Yes IO. Receive some data, send some data, in the C / S mode, and divide the two program models of the server and client depending on the received transmission line. So how do you deal with these IO? Let's take a look at a few common methods: Blocking? Read-write ???? About this most common model is: while? (Size? =? Read (fd,? Buf,? Max_size,? 0)?) ProcessMessage; ???? Almost unable to handle the situation in which multiple users are connected, because in this case, the operation of Read is blocked, will always wait until there is news to arrive return. So everyone thinks about a way to make this model for multiple users, then: Multi? Threading? Blocking? IO ???? is to connect to each user, open a thread to run the loop above .