And now that we have covered the basics of
Socket, I would like to end this tutorial series here. I feel that I have given you enough example projects and explanations of how to use the networking APIs (and then some) in the
System.Net namespace. From here, I'm fairly confident that anyone who has gone through this course should be able to write their own networked C# appliations and delve into some more advanced topics on their own.
Where To Go From Here
If you want to learn more, the best thing to do would be to pick and a project you want to make, and then build it! I'm really partial to video games; I already showed you how to network Pong earlier so you have someplace to start.
There were two topics that I didn't get to cover that I really wanted to. (Sorry, life got a little busy for me in the past few months).
- Asynchronous Sockets. This isn't simply calling functions that are marked with the
asynckeyword, it's a hole different beast & paradigm. Here are some good places to start on the MSDN documentation:
Using an Asynchronous Server Socket
Asynchronous Server Socket Example
Using an Asynchronous Client Socket
Asynchronous Client Socket Example
- SSL/TLS & Security. This is vital in modern computing and communications. There are way too many things to count that I could go over. Security in the .NET Framework is a good stepping stone, but poking through
SslStreamshould be something to do.
There are an ocean of third party (higher level) communication libraries available for C#. Some of the more popular ones include RakNet, Lidgren, and ZeroMQ. Each has its own purpose and complexity. You might find them a bit more useful and easier than the
If you'd like to study distributed data comm. here is pretty cool article on how to implement the BitTorrent protocol in C#.
All of the Source
If you were following these tutorials as I posted them, I only gave you the code for the projects in gists. Available now is a repo that contains everything (and the project files). You can find it here (GitHub mirror).
Least Significant Bits
My gratitude to Jason Francis (@halfspiral) for helping me test the Pong clone.
I'd like to make note of the folks over at /r/csharp. They provided some ideas for tutorials, extra insight on things, a code correction or two, and were the majority of my views. I don't think I'd put in as much effort as I did if it wasn't for the community there. Thank you.