Higher level API for working with sockets in C