Stevens' UNIX Network Programming has all the information you could wish for on using the BSD sockets API (which is now the standard sockets API) and how various UNIX systems interpret the functions in those APIs. It includes a lot of code demonstrating the topics under discussion. It is also very dense.
Beej's guide is a good, quick summary of how to use the sockets API. It might be one of the better places to start and just get the hang of the mechanics of putting together a server and a client. To understand why you're making those function calls with that data in that order, and what exactly the function calls are doing, you can turn to Stevens.
If you want to pick up best practices, take a look at production code: How does Mongrel 2 handle networking? How about lighttpd? Varnish? Why do they handle it the way they do?
You can also look at the implementation of the networking stack for a platform you're interested in. Grab the kernel source code, possibly a book discussing the kernel's design, and dig in.