Working with the System.Net.Sockets namespace
The default protocols are fantastic. They take away a lot of manual work. We do not have to program the HTTP protocol ourselves; we can focus on the content instead. The same goes for SMTP, POP3, and all the other protocols out there. You can find a class or a NuGet package if the protocol you want to use is popular enough.
But of course, sometimes you cannot find that package. Sometimes, you want to write your own protocol. In that case, you have to do all the hard work yourself. But, I have to be honest, I immensely enjoy doing that. There is something nice about writing my protocol, deploying it in my apps, and seeing them work together. And even if you do not enjoy this, there are cases where you have no choice.
The good news is that the good people who wrote the BCL have already done much of the underlying work.
In Chapter 6, we encountered the Socket
class when we discussed how systems can communicate. Sockets were mentioned...