Programming networks sockets directly, rather than using an abstraction or library, is a challenging task. This holds true in any language that exposes sockets from C and C++ to Python.
Challenging as though they may be, sockets provide an essential part of most modern computing, particularly interactive computing. Networked communication is a preferred way to get devices to talk to each other, from microcontrollers and embedded devices to enterprise servers.
Furthermore, the basic API for sockets is actually not that complicated, with most of the semantics not changing much since Berkeley Sockets. Even today modern operating systems implement some version of the Berkeley socket interface.
To explore sockets further I created an application in C++ that allows as user to interactively:
- Create a TCP or UDP
- Client or Server
- Specify the port to send data to or to listen on
The result was a greater appreciation for sockets and for the libraries and programs that make them easier to use.
Much of the code was adapted from:
- Beej's Guide to Network Programming: Using Internet Sockets Video Textures by Brian "Beej Jorgensen" Hall