Once upon a time (about 7 years ago) Beej's guides saved my life at work when trying to implement network stuff in C for a project at work I was in over my head on.
If there was more stuff like this in C-land I probably wouldn't have been clambering to get away from C and into more nurturing, sharing communities at the first opportunity.
Another relevant / extensive source is Unix Network Programming by W. Richard Stevens. Mostly relevant to Linux / Unix systems, but still worth a read.
Edit:
Matter of fact he lists it as the first reference under "More References"
Definitely a great read, one I recommend frequently. Nowadays, I reach for ASIO. I think I read yesterday it's going to be included in C++17? Much more portable than POSIX sockets. After reading this I implemented a multithreaded version [0], then started contributing to h2o [1].
Definitely a great and very instructive read, and one of the few to include IPv6 and the correct usage of getaddrinfo.
It's the guide I recommend to everyone who wants to learn about network programming in C. I actually purchased the (slightly expensive) printed version and never regretted it :)
Adding Shipping Costs to Germany bumps the price to about 22 USD (currently, 21EUR is what the receipt says). Considering the number of pages in this book in relation to its price, it is slightly expensive compared to your average "normal" book.
When comparing to other education text books though I'd not be able to complain. Neither am I, as I still think it was worth it, if just to support the author and to have an addition to the bookshelf.
I think there are better (more correctly written) guides to network programming, i.e., UNIX Network Programming (old, but the newest volume: The Sockets Networking API - was written in 2003), and TCP/IP Illustrated (also most recently updated with a 2nd edition in 2011) by the late, great W. Richard Stevens - despite his sole work being horribly out of date, with later volumes being worked on by Bill Fenner and Andy Rudoff, I would honestly look no further in lieu of socket programming in C.
More formal and comprehensive, absolutely. If you want something that's more friendly to neophytes, Beej's guide is the way to go. It's quite literally what they used in my upper div intro to Networking course at UCLA years ago.
A book that splits the difference very well is The Linux Programming Interface by Kerrisk. When I did network programming in class I leaned on it at least as much as Stevens.
It's a great book for all kinds of stuff, too, not just network programming.
Not just the Network Programming guide, all of beej's guides are pretty awesome -- Specific purpose and very readable (even for non-native english speakers).
Wow, I haven't looked at Beej in a long time. Everything's cleaner and even more useful for entry-level consumption. When I saw the link I first thought "boy, that's an oldie but goodie" but the 2012 really was accurate. Keep this in circulation. He deserves the kudos and the audience.
Back in college I wrote this address on the board and told fellow students that this was a good site to learn some C basics and learn network programming. Most people just laughed at the name, but I like to think Beej helped some people who decided to check it out.
Why can't (more) textbooks be written like this? There's no need to make CS dry -- as long as the technical details are correct, it can and should be fun to follow the work.
Well, maybe it's about taste. But I personally can't stand these kind of books. Take this paragraph for example:
> What's this? There are two types of Internet sockets? Yes. Well, no. I'm lying. There are more, but I didn't want to scare you. I'm only going to talk about two types here. Except for this sentence, where I'm going to tell you that "Raw Sockets" are also very powerful and you should look them up.
There are quite a few books written like this, including most online tutorials, and other resources.
What I don't like about it is that more than 50% of the content is filled with the author's anecdotes (some of them have better sense of humor than others), while the actual content being discussed is barely touched.
You'll never see this kind of content on advanced mathematics, or field that require intense concentration, advanced thinking, because it's difficult to switch the context of your thinking from the author's silly jokes to the actual thing you're trying to learn.
In this case, it's simply touching the very simple bsd socket api, so of course it's very easy to follow. But imagine that you removed all the unnecessary jokes and anecdotes, you'd end up with 50% of the text and 100% of the useful information. I'm pretty sure information density is a good quality to have for any piece of writing.
To compare to one of those advanced mathematics textbooks you're making an example of, D&F is one of the canonical texts for an introductory graduate algebra course, but it is one of the least user-friendly works I've come across on the topic (I own 3-4 other graduate algebra texts at various levels, printed in various decades, and I found it probably most difficult to wade through, of all of them).
Note that this is merely an example and not a personal attack on the authors or something. Having to re-read a chunk of text 5-10 times on average to extract pertinent information is something I really don't enjoy; I don't usually have to do it with journal/conference papers (usually 2x is enough to grasp the details of the idea being presented) or with other textbooks.
I would rather the information being presented be somewhat 'spaced out' to give my brain time to process it without having to go back over it. Having to re-read a denser text takes rather longer, imo, than having to read text with slightly less dense content just once or twice.
So, yes, it is likely a matter of taste. But my point was, I suppose, that information presented in a dense manner takes rather longer to digest.
Beej (despite numerous anecdotes and so on) manages to present his information in a straightforward fashion that doesn't require multiple readings to grasp. Algebra could also be presented in a similar (if probably less jokey) fashion. A lower amount of entropy per sentence means I have to do less work just to get through the explanations and can spend more time on working through the examples. Given that the time I have to spend studying is finite, a more direct approach to explaining material before letting a student practice does seem more efficient.
That's why I like this tutorial. It doesn't take itself seriously, which is rather more approachable than some works, and the pertinent information is directly presented but not in such a way that I have to re-re-re...-re read to grasp the details.
I like the style. He draws attention to things that would get lost if he just stated them in the most concise form possible.
I also find it easier to ingest; I wish I had known about this guide a few years ago. I learned socket programming from man pages. It's an experience I don't want to recommend.
Agreed. I call this "flowery language" and I try to ensure it is omitted in guides, api documentation, source code comments, etc. Humor, frustration, anecdotes, complaints, etc. do not belong in a technical guide. Maybe in a blog, maybe in a talk.
Richard Stevens certainly found the right balance, I've read almost all of his material, yet I don't have any sense of his personality or personal history other than that he is very professional.
Haha! I remember using Beej's guide to get me through networking and distributed computing back in college. The courses weren't terribly useful, but Beej covered the practical side of it quite nicely.
I read this guide, used it only a few years back when I wanted to learn more about network programming. It's a very well written guide. Certainly a great way to learn about network programming!
If there was more stuff like this in C-land I probably wouldn't have been clambering to get away from C and into more nurturing, sharing communities at the first opportunity.
Really cool to see he's keeping it up to date.