Readit News logoReadit News
vajrabum · 3 years ago
All Beej's guides are fantastic, but if you're interested in Network programming you could do way worse than follow this up with his guide to network concepts. https://beej.us/guide/bgnet0/

If you search Algolia for Beej you'll see his material has been on hacker news numerous times.

sph · 3 years ago
Anyone knows of a well-rounded guide that explains the structure of the Internet at large? I know everything listed in the one you linked, but I have a nebulous idea of how anything works after my packet exits my gateway.

So, BGP, autonomous systems, peering agreements and other site-to-site routing protocols that keep the entire Internet infrastructure ticking along.

capableweb · 3 years ago
I don't know of any one resource that gives a overview of everything, I find that browsing Wikipedia for each topic gives a good overview of each topic though, with the overview being the "Internet Architecture" category: https://en.wikipedia.org/wiki/Category:Internet_architecture

Some bookmarks I have regarding BGP and peering that dives into it a bit:

- https://www.fortinet.com/resources/cyberglossary/bgp-border-...

- https://aws.amazon.com/blogs/architecture/internet-routing-a...

- https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_bg...

tonightstoast · 3 years ago
https://learn.cantrill.io/p/tech-fundamentals

I found Cantrill’s course pretty solid. It is free and you can just skip to DNS & DNSSEC.

garfieldnate · 3 years ago
I thought "How the Internet Really Works" (https://nostarch.com/how-internet-really-works) was pretty good.
kayge · 3 years ago
> If you search Algolia for Beej...

Or, as I just recently learned, you can click on the (beej.us) domain name next to the title at the top of this page and it will take you to a list of all the HN submissions for the site:

https://news.ycombinator.com/from?site=beej.us

fileeditview · 3 years ago
Nice! Thanks! For years on HN and I didn't know that.
tombert · 3 years ago
I agree with everything you said. Additionally, I think that the ZeroMQ guide is also a great resource to learn a lot of the common networking patterns, even if you don't plan on using ZeroMQ directly.

https://zguide.zeromq.org/

jamestimmins · 3 years ago
Is this better as a preface to Network Programming or a suffix?
vram22 · 3 years ago
Yes, it seems reading about the concepts should be done first.
keyle · 3 years ago
There is also a C guide [1] which has a pretty interesting email policy...

     I’m generally available to help out with email questions so feel free to write in, but I can’t guarantee a response. 
     I lead a pretty busy life and there are times when I just can’t answer a question you have. 
     When that’s the case, I usually just delete the message. It’s nothing personal; 
     I just won’t ever have the time to give the detailed answer you require. [...]
[1] https://beej.us/guide/bgc/html/split/

mu53 · 3 years ago
I love this level of honesty. It is true, but people never say it
ryandrake · 3 years ago
I had a work colleague with a similarly refreshing Out-Of-Office E-mail autoresponder that included something like: "I'm on vacation. When I get back I'm not going to have time to read all my missed E-mails. So your mail is going to be ignored and deleted with the other 2,000 unread mails. If it's important, E-mail me again after I return on [date]."

That's how you do it!

ly3xqhl8g9 · 3 years ago
Here's a product (Gmail/Outlook add-on or so): have your own LLM trained over your public texts (articles, books, blog entries, READMEs, Hacker News comments, and so on), mark the emails you can't respond to with the "GPT" label which puts the mail in a queue and if you don't remove the label in 7 days or so, it sends a response with a polite intro "I didn't have the time to get to your email, but here's what I might think as a response".
bachmeier · 3 years ago
I can speak from experience that posting that type of material will generate some interesting email inquiries. I used to get email messages with a 4000-line program, multiple datasets, and "My program doesn't work. Can you tell me what the error is?" The awkwardness of deleting the message is less than the awkwardness of refusing what someone else views as a 30-second request.
lannisterstark · 3 years ago
Why not like ...just leave the message alone lol?

We don't have 64 Kilobytes of limited memory on our email servers anymore.

pluijzer · 3 years ago
When you know you definitly do not have time for an answer deleting it might unload your mental burden. Keeping hundreds of unamswered messages around might feel like an unresolved issue.
remram · 3 years ago
There's no functional difference between "not looking at it ever again" and "deleting it".

You should understand when they say "delete" that they mean "remove from their queue", whether it still exists in an "archive" folder, backups, trash, ... is irrelevant.

Jorengarenar · 3 years ago
Liking to have clean and empty inbox isn't related to limited memory
ftxbro · 3 years ago
> "The way I see it, it's the educators who hold all the power in the world. No, stop laughing and hear me out. A good instructor can, over the course of their career, create hundreds of millions or even billions of dollars of GDP. Let's say a teacher teaches 40 students a year for 30 years. And Each of those students goes on to work for 40 years. And, due to the quality of instruction, they earn $10,000 more per year than they would have otherwise. That's $480 million in extra revenue. From one good instructor."

OK but providing value isn't the same as having power. It's almost the opposite thing.

jrumbut · 3 years ago
> OK but providing value isn't the same as having power.

Providing value is absolutely a way of having power. You change the world, that's power.

Having power isn't the same as yielding benefit (for yourself).

TeMPOraL · 3 years ago
When people talk about having or not having power, they rarely mean magnitude alone. The more important component is control. Can you wield your power to achieve some specific goal of yours? Can you use this power to overall improve your life, and lives of those you care about? Can you use this power to protect yourself from someone else using their power to achieve something at your expense?

Beej's teaching power only answers "Yes" to the first question here - and that's only if your goals have something to do with teaching or improving the world overall, somewhere, for some people.

oreally · 3 years ago
Yea he's using economic output as a measure.. then equating it to having power, which is laughable.

Anyway, in an age of information abundance and videos, educators are overvalued if they just give instruction alone. It's the whole package, the checks and balances on the student, that possibly provides some sort of value. Then again, there are irregularities, like the programmer who's never been to college who contributes as much or even more.

whimsicalism · 3 years ago
What are you quoting?
ftxbro · 3 years ago
it's beej saying why he write guides
dang · 3 years ago
Related (note: reposts are fine after a year or so - https://news.ycombinator.com/newsfaq.html):

Beej's Guide to Network Programming (1994-2020) - https://news.ycombinator.com/item?id=26100075 - Feb 2021 (165 comments)

Beej's Guide to Network Programming - https://news.ycombinator.com/item?id=13983212 - March 2017 (44 comments)

Beej's Guide to Network Programming - https://news.ycombinator.com/item?id=13670971 - Feb 2017 (6 comments)

Beej's Guide to Network Programming - https://news.ycombinator.com/item?id=12402313 - Aug 2016 (4 comments)

Beej's Guide to Network Programming (2012) - https://news.ycombinator.com/item?id=9445692 - April 2015 (31 comments)

Beej's Guide to Network Programming - https://news.ycombinator.com/item?id=7584974 - April 2014 (1 comment)

Beej's Guide to Network Programming - https://news.ycombinator.com/item?id=5241220 - Feb 2013 (47 comments)

Beej's Guide to Network Programming - https://news.ycombinator.com/item?id=584557 - April 2009 (22 comments)

Guide to Network Programming - https://news.ycombinator.com/item?id=337371 - Oct 2008 (7 comments)

peter_l_downs · 3 years ago
Posted a million times before, and should be posted a million times again in the future. This is one of the only reference books I've ever used, and it got me through my first real programming job. Wonderful text. Thank you, Beej!
eep_social · 3 years ago
This is probably the best one: https://news.ycombinator.com/item?id=26100075
gabagool · 3 years ago
Could be wrong, but isn't this the same Guide?
b33j0r · 3 years ago
My nick has been Beej or b33j ever since starcraft or counterstrike 1.5.

I will always bring up “but you know who the real beej is, right?” if the other person is a nerd.

tomcam · 3 years ago
Now maybe I have to change all my usernames to animats0r for the same reason
b33j0r · 3 years ago
Funny enough I only got this joke on my second read. One of my uncles had a company with a name similar to your joke :D ADD probably.

So, to me it was beej. But in reality, to the public [you can’t nickname yourself].

So it’s always been b33j0r. My friend who had the first dedicated server I encountered named me that because my name is Brian Jor—-

Finding me has been trivial since I first AWP’d in a CAL-O match. This was before scoutznknives were more than merit badges.

Deleted Comment

girvo · 3 years ago
> counterstrike 1.5

I miss WON. Man my friends and I hated Steam when it came out...

alberth · 3 years ago
Beyond this being a fantastic document, I really appreciate it being offered as a single HTML page:

https://beej.us/guide/bgnet/html/

asdfkljvalkj · 3 years ago
The funny thing is at the time downloading that took like 5 minutes back in the day.
schaefer · 3 years ago
And a physical print book.
kqr · 3 years ago
Open question: in what fields are you working where you really need to work with actual sockets? Most of the network programming I do fall into one of two categories:

1. A library exists to abstract over the bytes-into-sockets layer, meaning I don't need to deal with it; or

2. A library probably exists to abstract over the bytes-into-sockets layer, but I've chosen to ignore it either because I'm truly ignorant of it, or for intellectual stimulation.

(Note that in category 2 I count things like "not using protobuf/thrift/etc. for IPC.)

When are these things not true? Genuinely curious! I'm guessing interfacing with existing obscure third parties, or using obscure language environments, but what are examples of that? And what other usages are there?

fredrb · 3 years ago
I don't work with it either. But I find that learning the abstraction below where you're working at can be quite beneficial to understanding the constraints of your layer, debug, and solve problems.

E.g.: Learn the basics Transport Layer protocols (TCP/UDP) if you work with HTTP

dan-robertson · 3 years ago
1. Writing the libraries you describe

2. Speaking unusual protocols for which (good) libraries don’t exist.

3. I think interacting with the sockets api can also be relevant for tweaking various options to get better performance (though often there are Linux defaults that can be tweaked instead)

kqr · 3 years ago
I'm fully aware of the hypotheticals – what I'm curious about is which your personal experiences are with e.g. those three points you list.
kragen · 3 years ago
at knownow i wrote an event-driven nonblocking http server in python with asyncore which could efficiently do comet over hundreds of concurrent http connections; existing http libraries were all blocking at the time

i also wrote a similar event-driven nonblocking http client in c for benchmarking and load-testing both that server and a different compatible one being written by another team in c++. this was nonblocking because it was important for the client to be faster than the server. at the time there was no libevent/libev/libuv so i wrote my own

at satellogic i maintained the upper layers of our cubesat space protocol stack, which provided a socket-like interface to our coap stack, which i also maintained part of

i also had to tweak kernel socket buffering settings for rabbitmq there

for wercam i'm experimenting with different approaches to ipc for efficiency; the data being transferred are pixel buffers so i don't think protobuf/thrift/etc. is going to help

for the mail server i share with some friends i wrote a milter in python to smtp-reject outside email to certain recipients unless it matched a whitelist; milter doesn't speak pb either and i couldn't find a python library

i wrote a multicast file transfer program in python (bccpo/bccpi) for copying files across the lan without having to fiddle around with ip addresses; the data being transferred is just (multicast) the ip and port and (unicast) the filename, file size, and file contents, so again i'm not sure pb would simplify anything. the hard part of getting it working was just multicast

i wrote a chat client for icb in python with asyncore, and again i couldn't find a suitable library

even when i'm using a library, it's often pretty useful to be able to read strace output or use select or poll with the file descriptor it's trying to hide from me

i don't think any of these qualify as either your category 1 or 2

i've also done a huge number of things that fall into category 2, of course, like writing an irc client in bash, writing a web server in assembly, and writing a chat server in three 80-column lines of c, writing a mud, and so on

forrestthewoods · 3 years ago
There is a whole universe of programming that exists outside of webdev. Firmware, video games, high performance systems, etc.
JustSomeNobody · 3 years ago
This. I think HN leans very heavy on webdev and somehow forgets that the entire rest of the planet runs on software also.
samtho · 3 years ago
I often work in a resource constrained environment where my program size is measured in two-digit kilobytes, RAM is measured in the single-digit kilobytes, and it can’t exceed some current measured in mA/h. When I am simply sending a UDP packet, I didn’t need nor can I afford the footprint that these libraries have.
synack · 3 years ago
It's useful to understand the socket API so that you can do things like read the output from strace, notice that accept() returns EAGAIN too often, and know what that indicates.
GoblinSlayer · 3 years ago
At least on Unix and Windows file read and write methods work for sockets too, so streaming bytes isn't different.

How would you implement, say, netcat? Launch a jango rest service with kubernetes, which will run in a wm if it's a wrong OS, create a certificate with letsencrypt and access it with a react electron app?

kqr · 3 years ago
Why would I implement netcat when netcat is already implemented? That's sort of why I'm asking – at least in the circles I move, all the low hanging fruit are already picked, and picking the high fruit seems rare, so I'm interested in which people do and what those fruits are!
DoingIsLearning · 3 years ago
Had plenty of use cases where even zmq was overkill.

E.g. interfacing a research machine with an OEM machine or a machine to a standalone embedded target, sometimes it makes sense to just serialize, send over a socket, ethernet crossover cable and be done.

kqr · 3 years ago
Your description makes it sound sort of like temporary code to perform a one-time (or few-times) job, and not something that's running and maintained for years. Is that a fair characterisation or am I misunderstanding?
JustSomeNobody · 3 years ago
I implement protocols to communicate with various hardware (RFID, LiDAR, etc). Most of these communicate over sockets. Some still use serial. I have a library I wrote of socket routines that I use, so it's not like I re-implement that every time, though. And for this, I'd really rather use my library than a 3rd party in case I have to dig in and see what's going on.