On simple APIs

Sun, 26 October, 2008

I wrote about my effort to learn sockets programming properly. For two weeks, every day, I wrote a simple socket server in C, from memory as much as possible.

It paid off this last week at work, when I finished a draft of a proxy server that sits between an existing server and a Flash client. A proxy is both a server and a client, so all my new skills were used, albeit in C# not C. The nice thing about sockets is that the API is fairly standard for all technologies - Unix and Windows have similar C API's, and all higher level languages simply wrap around them.

I'm so glad I learned the C first, since the standard API is lean. There are about 6 - 8 functions to learn to use.

Had I attacked this issue starting with C#, I'm certain I would have failed. The "user-friendly" wrappers contain a lot of distracting material. Furthermore, the MSDN documentation for class members always includes a program that does eight things, instead of being distilled down to the one thing I want to do.

So, here's to the distillation of problems down to their simplest atoms. I'll take bind(), accept(), and send() over SocketInformation, SocketInformationOptions, SocketFlags, and SocketOptionName any day.

About Me

Erik Mackdanz is a software developer in Austin, Texas, along with everybody else.

Links