Writing High Performance Sockets in C#

Many unexperienced server coders believes the socket decides a large part of the server application performance behavior. On one side they are right, however, it is the overall performance which counts. Yet the socket is a part which many does not get how to use right and then "kills" the performance of the server applications. 

Blocking vs. non-blocking

The largest and most critical point when it comes to socket is determined if you chose blocking or non-blocking sockets. (Often referred to as non-async and async) A blocking send function means that the send function will have to wait for the data it sends to be sent before it is done calling the method. When it is a non-blocking, it means the send function is queued to the .NET thread pool, and when the data has been sent, it calls a callback method. A good example is a server application which is designed to hold tens of thousands of connections and respond to requests. If we had to use blocking methods, we would have to create one thread per individual connection which later on would not make the server application really scaleable. On the other hand, if we used non-blocking methods, no extra threads would have to be created since the .NET thread pool takes care of that for us. In addition to this, we would not have to wait for data to be received on each individual thread since callback objects takes care of that. 

The Incredibly Great Revolutionary iPhone 5

After nearly one year with my Nokia Lumia 800, I decided to go over to the dark side; buy the new iPhone 5. Even though I liked the user interface on the Windows Phone platform, the phone was easy to use, there was still small details with the phone that did not make it fit for my use. Multitasking was not implemented good enough. Applications always had to start up from beginning when I tapped their shortcut or tile on the start screen. Even though the OS itself was fast and snappy, the 3rd party apps (some of Microsoft as well) had tons of bugs and had incredibly poor performance (Spotify and Facebook, just to mention a few). This made me switch over to the iPhone 5. I was already happy with the app support on my iPad, so I assumed I would get the same experience on my new iPhone.