Well here I am again, this week I finished up chapter 15 and decided to test some of my knowledge and basic understanding of C++. I went ahead and took a quick break from Beginning Visual C++ and spent the better part of the day reading another book called Network Programming for Microsoft Windows Second Edition. It's a wonderful book which explains the very basic fundamentals of winsock design. The first chapter introduces winsock in a nutshell. You know in my years of dabbling with an equally wonderful programming language (Delphi/Pascal) I never really received the full benefits of having the MSDN at my finger tips. I always wondered how are these developers coding this stuff! I didn't realize at the time that MSDN is the best place to start. In reality it's this huge library or network of intense documentation and instructions on virtually everything with respect with Microsoft development. A very useful tool indeed!
So I really wanted to test my basic understanding of programming and figured I'd experiment with a simple console based client/server application. It was a bit perplexing when I first looked at some of the snippets but what was important about this process wasn't necessarily understanding the code (which was obvious) it was really the fact that this is the very first time I have truly used the MSDN for help and I understood a good 80% of what I was reading the first time around. I admit I had some trouble and went back a few times to underscore some of the important information usually overlooked by most people who are new to C++, for instance why are we linking ws2_32.lib and mswsock.lib, advapi.lib, etc... These were questions that concerned me and with a little bit of curiosity and persistence I learned something new. I honestly believe that many of us who start off make good programmers long before we ever write any code. It's that desire to learn and the enjoyment we feel when we actually do follow through with a commitment. It's an achievement and it feels good. Coding is much more than simply producing something - a program or a "tool". It's an art and a passion. You know when we use a plugin or a tool or some script we often forget the time and sacrifice the individual put into the code. I think this experience has changed me in a way because I see these achievements others have displayed and my respect has gone way up. When you see 500 or so lines of code that may have taken days or weeks for someone to develop or a nice interface that someone had to manually go in and create hundreds of event handlers for you forget or you just simply don't understand the effort behind the creation nor the respect for the brilliance behind the mind. It's amazing really. Moreover, if we stop trying and just wait for someone else to code a new tool or develop another script or reverse another application we might be waiting forever and that tool may never come. Which is why I'm determined to do this and do it the right way, page by page and line by line. I'm convinced now... There is only one right way to code and thats with your mind and your heart, otherwise you'll never finish it.
Now, this eh winsock application is really cool MSDN put out this example for a client and server and i've actually created a project for those of you who want to play with it. You can also check out this link to read up it took me maybe a three to four hours to finish.
Getting Started with Winsock - MSDN
Here is the result