http://asawicki.info/ Graphics programming, game programming, C++, games, Windows, Internet and more...
Sockets and How to Learn Them
Everyone who wants to code transferring data across a network has to learn the concept and API of sockets, no matter if he works in Windows or Linux. I currently work with them again. The most popular tutorial to start with sockets is AFAIK Beej's Guide to Network Programming (and here is my mirror of the Polish translation: [html], [pdf]). I've recently came across another great document: Winsock Programmer's FAQ. I generally like FAQ-s as a good way to start learning about new topic and this one contains many valuable advices. I especially like the article Which I/O Strategy Should I Use? beacuse it explains what ways are available to do asynchronous I/O with sockets under Windows.
Each time I use sockets, I ask myself whether it has to be so much complicated, with all these states, errors, structures, flags etc. I'm afraid it always has to be this way as I've seen many implementations of wrappers and all looked very similar or almost the same as the original. The only way to simplify this API is to limit its functionality or to take it to the higher level of abstraction, like RPC. I believe writing network code is so hard because: