As part of my usual routine, I’m trying out writing some code in C, to get a feeling for a different environment. I wanted to build something that is both small enough to complete in a reasonable amount of time and complex enough that it would allow me to really explore how to use things. I decided to use C (not C++) because it is both familiar and drastically different from what I usually do. The project in question? Implementing the network protocol I wrote about here. Another part of the challenge that I set out for myself was to make this code as production quality as I could, which means paying all the usual taxes you would expect.
The first thing that I had to do was to figure out how to actually perform networking and work with SLL in C. Something that would take me 5 minutes in C# took me a several hours of exploring and figuring things out. Eventually, I settled down on the obvious choice for SSL with OpenSSL. It is portable, reasonably well documented, and seems fairly easy to get started with.