Preface   Next Page 


While there are resources out there to learn about C#'s networking capabilities, I had some issues with finding the information myself in some nicely organized and well written tutorials.  I've don network programming in other languages, but had no idea how to use C#'s APIs.  I know that there are other people out there like me, so I thought about writing a set of tutorials about the System.Net namespace.

This is not a tutorial on networking (explicitly), but how to use C#'s networking API.

I work primarily with Linux, therefore Mono will be my runtime of choice (don't worry, it should still work with Microsoft's .NET VM).  I'll make sure the code provided can be run in just a command line interface, so we won't need to worry about GUI programming at all.  I'll try to keep the example simple and short, but I may include some larger and more complex applications.  I will also include full source code for each example/tutorial.

Through this tutorial's sections, you might see messages like the one below, it's a good idea to pay attention to them (like the one below for Linux users).


If you run Ubuntu (or a variant of it like me), make sure you have Mono installed from the project's official repository.  It's more up to date than the one in the Canonical repos.  Be sure to install the ca-certificates-mono package.  This makes it much easier for you to use SSL with Mono.


I'll try to keep the amount of extra dependencies & packages to a minimum. For the basic stuff, we shouldn't need anything more than what's provided to us in System.Net.


Source Code

Each of the tutorial sections have thier own full source examples.  If you want, you can download the entire collection (and project files) over here (GitHub mirror).  All of the code examples that I have included fall under the Unlicense (a.k.a. Public Domain), unless otherwise noted.  If you end up using my code somewhere, credit for authorship is appreciated.


How To Use This Guide

The main tutorial sequence is numbered off on the left.  You don't have to follow it in order, or read all of them, but it's recommended.  Everything else that isn't numbered are just one-off, "micro-tutorials."

I recommend reading all of the text.  Do not skimming anything.  When it comes to code, try not to just copy n' paste the example.  While it may take more time and effort, copying the code by writing it out in your editor is probably the best way to learn and memorize it.  It's what I do with most of the tutorials I read online.  I suggest you make one solution to contain this tutorial, but one project in the solution for each topic/section.

Since we're also dealing with communications, I highly advise that you have a computer somewhere else in the world where you can run and test these programs.  While running a server & client on your local machine is fine for development, it's not realistic of what happens in the real world.  I'd recommend spinning up a VM on a service like Google Cloud Platform, Digital Ocean, or Amazon Web Services.


Contacting Me

If you have any questions, comments, or requests send me an email.  If you send me a message like "Can you look at my code.  I don't know what's wrong," or any other technical questions, I'm not likely to respond.  If you do copy n' paste code from here, and it turns out to be wrong, please do notify me so I can fix it.  All of the examples will be hosted on Github's Gist service.

 Preface   Next Page