[HN Gopher] Beej's Guide to Network Programming (1994-2020)
       ___________________________________________________________________
        
       Beej's Guide to Network Programming (1994-2020)
        
       Author : ColinWright
       Score  : 766 points
       Date   : 2021-02-11 10:31 UTC (12 hours ago)
        
 (HTM) web link (beej.us)
 (TXT) w3m dump (beej.us)
        
       | indigochill wrote:
       | This guide saved my butt in school when I suddenly had to do C
       | network programming with no relevant experience.
        
         | julianh95 wrote:
         | I share the same experience as I am currently taking CS6200 at
         | Georgia Tech.
        
           | indigochill wrote:
           | Haha, that was the exact class where I used it! Loved that
           | class, though. By far my favorite in their MS program. It
           | awakened a love for operating systems (and the general
           | applicability of the concepts). AOS was also good and made me
           | appreciate the point of cloud computing more.
        
       | stjohnswarts wrote:
       | I credit beej to my first serious job. I worked through the
       | network and concurrency guides and landed the job that started me
       | off on my career. Thanks Beej! Please keep it up :D
        
       | seishan wrote:
       | I remember reading this when I was in high school out of
       | curiosity. Thanks again for writing this (and many more), Beej.
        
       | jason0597 wrote:
       | Beej has had great guides for many things on the internet for
       | decades. I fondly remember learning C from Beej's guide to C [1]
       | upon being recommended by WinterMute (from the Nintendo
       | homebrewing community). Best introduction to programming I've
       | seen by far!
       | 
       | [1]: https://beej.us/guide/bgc/
        
       | jjice wrote:
       | One if the best guides/books on programming I've ever read. This
       | taught me the foundations of network programming and the fact
       | it's available for free is incredible. I just took a second and
       | ordered the paperback right now because of how fantastic it is.
       | 
       | Aside from the book being really in-depth and understandable,
       | Beej adds in quite a bit of humor and that is something I love in
       | a good software book.
        
       | scudd wrote:
       | Currently taking Graduate Introduction to Operating Systems at
       | Georgia Tech, and this guide has been like a bible for me. Huge
       | thanks to Beej!
        
       | archsurface wrote:
       | This site has become groundhog day, should just automate re-
       | submission: https://hn.algolia.com/?q=beej
        
       | kebman wrote:
       | "Some of you might want to do things the Pure Windows Way. That's
       | very gutsy of you, and this is what you have to do: run out and
       | get Unix immediately!"
       | 
       | He's just joking of course. At first glance this seems like a
       | great read. And he's funny too! :)
       | 
       | I do wonder how much of this is applicable to Rust though.
        
         | kruxigt wrote:
         | "At first glance this seems like a great read" Agree!
        
         | hoseja wrote:
         | Sadly the Windows asynchronous (or something, I never quite got
         | it) networking API seems very powerful. But I never found a
         | comprehensible manual/tutorial for it.
        
           | whizzter wrote:
           | Dr.Dobbs has had at least 2 articles on it.
           | 
           | https://www.drdobbs.com/open-source/io-multiplexing-
           | scalable... (Also covers select and /dev/poll but lacks
           | epoll,kqueue)
           | 
           | https://www.drdobbs.com/cpp/multithreaded-asynchronous-io-
           | io...
           | 
           | I remember chatting in the fringes when nodeJS was doing
           | their proper win32 porting and they did have some issues
           | getting things stable due to lack of documentation but iirc
           | got some help from MS so the libuv code should be usable as a
           | reference for behaviours (As well as being fairly battle
           | tested by now).
           | 
           | https://github.com/libuv/libuv/tree/v1.x/src/win
        
           | the_only_law wrote:
           | I've been trying to figure out the entire windows networking
           | stack recently, particularly some more obscure parts and the
           | docs have been pretty bad unfortunately. A lot of the higher
           | level stuff fees really superficial and the lower level stuff
           | it's it own mess (all sorts of broken links and links to
           | outdated versions in the NDIS docs).
        
       | ghoshbishakh wrote:
       | Good for getting started with network programming. My university
       | refers this for the computer networks lab course.
        
       | tumblewit wrote:
       | Georgia Tech's Graduate Introduction to Operating systems OMSCS
       | class rings a bell. Socket programming was fun in that class. And
       | by fun I mean hours of hair pulling while debugging.
        
         | wackspurt wrote:
         | My latest immersion into Beej's guide was through the GIOS
         | course too! It also opened my eyes to the amount of
         | familiarity/expertise my older co-workers had with systems
         | programming (they helped me when when they heard me whining
         | about the socket programming assignment). It taught me not to
         | dismiss someone just because they don't know the latest
         | TensorFlow API/Neurips paper.
        
         | person_of_color wrote:
         | Was OMSCS worth it?
        
       | peter_retief wrote:
       | This is so useful I can't believe I have never seen it before.
        
         | Shared404 wrote:
         | Be sure to check out Beej's other guides. They're some of the
         | most useful I've seen.
        
       | lxeiqr wrote:
       | Despite of its age, Beej's Guide is still one of the best
       | introductions to network programming I've seen so far. I love how
       | apart from the basic and concise explanation of TCP and UDP (and
       | generally sockets in UNIX-like environments), there's also a
       | separate, short "Advanced Techniques" section that can be very
       | useful if you want to explore the subject even further.
        
       | freakynit wrote:
       | Such simple, but informative guides should be how official
       | documentations should be written.
        
       | [deleted]
        
       | armadsen wrote:
       | I had the privilege of working with Beej for a couple years at my
       | last job. He was one of my favorite coworkers I've ever had. Just
       | great to be around and work with. Incredibly sharp, but also
       | humble, easygoing, and eager to just solve problems.
        
         | beej71 wrote:
         | The feeling is mutual!
        
       | gspr wrote:
       | I had the most wonderful deja vu the other day. I needed to do
       | some serious-ish network programming for the first time in 20
       | years. I googled around a bit for a refresher. What do I find?
       | Beej's guide - the same Beej's guide that was my first
       | introduction to the topic 20 years prior!
       | 
       | It was wonderfully poetic to me that the same document that
       | taught me how to make a wildly dangerous IRC bot in my teenage
       | room for the lulz also re-taught me the stuff I needed to deliver
       | a low-latency ML offloading demo at my serious(-ish) job 20 years
       | later. Gave me a real warm fuzzy feeling :-)
       | 
       | PS:
       | 
       | HN disucssion anno 2015:
       | https://news.ycombinator.com/item?id=9445692
       | 
       | Anno 2017: https://news.ycombinator.com/item?id=13983212
        
         | toast0 wrote:
         | > It was wonderfully poetic to me that the same document that
         | taught me how to make a wildly dangerous IRC bot in my teenage
         | room for the lulz also re-taught me the stuff I needed to
         | deliver a low-latency ML offloading demo at my serious(-ish)
         | job 20 years later. Gave me a real warm fuzzy feeling :-)
         | 
         | My experience with CTCP flooding large channels channels and
         | causing netsplits in my youth provided a perfect base of
         | understanding for when my production servers started flooding
         | status updates to each other and couldn't stay connected.
         | 
         | PS sorry, undernet admins and users. Also, thanks to the admin
         | on #quebec who asked me to flood his channel so he could tune
         | his bot to block flooders.
        
         | gspr wrote:
         | I thought I'd add: I know that this is a very normal thing in
         | some sense. Many textbooks remain relevant for decades and
         | decades (I'm a mathematician, we know this perhaps better than
         | most). But still, it's rarely the case for an online document -
         | one about computer technology even more so!
        
       | pknerd wrote:
       | Would be interesting to see a Go or Rust version not it.
        
       | dang wrote:
       | Past discussions on this classic include:
       | 
       | 2017 https://news.ycombinator.com/item?id=13983212
       | 
       | 2017 (a bit) https://news.ycombinator.com/item?id=13670971
       | 
       | 2016 (a bit) https://news.ycombinator.com/item?id=12402313
       | 
       | 2015 https://news.ycombinator.com/item?id=9445692
       | 
       | 2015 (a bit) https://news.ycombinator.com/item?id=9623813
       | 
       | 2013 https://news.ycombinator.com/item?id=5241220
       | 
       | 2009 https://news.ycombinator.com/item?id=584557
       | 
       | 2008 https://news.ycombinator.com/item?id=337371 ("Wow, I first
       | read this when I was in high school. It's still being updated?")
        
       | [deleted]
        
       | beej71 wrote:
       | All your kind words are literally bringing tears to my eyes--
       | thank you!
       | 
       | My current plan is to keep writing freely-available guides for as
       | long as I can reach the keyboard. And maybe even longer with what
       | will undoubtedly be awesome futuristic speech recognition--or
       | mind-reading! That's not scary at all!
       | 
       | I'm leaning on bash/zsh scripting one I finish the utterly
       | gigantic C guide I'm on now... hopefully later this year. But I'm
       | always open to suggestion for topics... :)
        
         | runetech wrote:
         | Your original document was the quintessential resource for me
         | in the 90s. Heartfelt _thank you_ for putting me on track back
         | then. Highly appreciated!
        
         | bretpiatt wrote:
         | I've pointed so many folks over the years to your guide.
         | 
         | Keep up the great work.
         | 
         | P.S. Each time I do refer folks over or see a thread like this
         | gives me fond memories of the O'Connell labs and the
         | opportunities we had to enjoy networking in the early days.
         | 
         | The fun of the HP bug of the week and running a unix farm with
         | shell accounts for all of us students.
        
         | UseStrict wrote:
         | Amazing! This guide got me into network programming back when I
         | was still on rural dial-up. It helped me through various
         | programming courses in high school and university, and I still
         | occasionally refer to it from time to time. Thanks for your
         | contributions, they really improved my quality of life!
        
         | tetrahedr0n wrote:
         | For the brief amount of time I was your student at Lambda, you
         | made a huge impression. Beyond this tutorial, you're a gifted
         | teacher and inspirational person. Much respect and love!
         | 
         | I'll read your future-brainwave-transmission tutorials,
         | anytime, even if they run the risk of causing minor insanity!
        
         | ilikedthatone wrote:
         | you are the definition of hacker for me, thank you for your
         | time, efforts, sense of humour, empathy, existence.
        
         | ColinWright wrote:
         | When was the first edition? I feel like I remember using it in
         | the early 90s ... maybe 1991? The mods have put the dates
         | "1994-2020" in the title, but I feel like I remember it from
         | earlier than that.
        
         | paraboul wrote:
         | Your page was what bring me into "magical" programming as a
         | teen 20 years ago. Being able to communicate with a remote
         | program on a free shell and actually understand how it works
         | was the best feeling.
         | 
         | This indirectly shaped my life in many ways. Thank you!
        
         | morty_s wrote:
         | Echoing a similar sentiment here, Thank You!!!
        
         | Issaclabs wrote:
         | You have touched so many people and have created real value
         | with your work
        
         | daotoad wrote:
         | This guide was instrumental in letting me understand sockets
         | and network programming. I've probably recommended it to at
         | least a hundred other people over the years.
         | 
         | You have made a huge positive impact.
         | 
         | Thank you.
        
         | aynsof wrote:
         | Your guide single-handedly got me through network programming
         | in C at university. This was back in the early 2000s. Thank
         | you! And I'm so happy to see your guide still getting updated.
        
           | int_10h wrote:
           | How funny - it got me through the same course but barely 2-3
           | years ago.
        
       | tpl wrote:
       | Wonderful resource, really helped me have fun playing with C
       | sockets. Thank you Beej!
        
       | stiff wrote:
       | Production failures due to bugs in both TCP-based servers and
       | clients happen all the time, long time ago I invested a little
       | time to learn basic socket programming in C and the ROI on this
       | has really been spectacular. "Unix Network Programming" by
       | Stevens is a great book on this topic, in particular it carefully
       | discusses all the different ways things can go wrong. Wish there
       | was something more up to date that could be recommended, but I
       | don't know anything of comparable quality, so I think you still
       | have to read it and later work out all the Linux-specific
       | details, more modern APIs like epoll etc.
        
       | TheSpiciestDev wrote:
       | As soon as I read the title, I felt joy! I had followed this
       | guide when I had began programming early on and had a great
       | experience. I recognize it by its name alone!
        
       | folex wrote:
       | Strangely no mention of High Performance Browser Networking
       | https://hpbn.co
       | 
       | I also would mention Distributed systems for fun and profit
       | http://book.mixu.net/distsys/ while being not exactly about
       | network programming, it is likely a next step for anyone who's
       | building apps that is scattered across several backends/services
       | connected by the network
        
         | jcrubino wrote:
         | Beej's is the classic of classics.
        
       | [deleted]
        
       | idolaspecus wrote:
       | It sounds like Beej needs to write a "Beej's Guide to Writing
       | Guides".
        
       | mbag wrote:
       | Glad to see this is being updated. I have used Beej's Guide to
       | learn network programming back in 2013 or 2014, and it was such a
       | great resource.
        
         | [deleted]
        
       | davidw wrote:
       | Among other things, Beej has been a leader in putting together
       | events and connecting software people here in Bend, Oregon. Well,
       | when getting together was a thing, at least.
        
       | easytiger wrote:
       | Pretty much learned c via this back in the day. It feels like it
       | was in the 90s, but might have been early 2000s
       | 
       | edit: it was the 90s
        
       | master_yoda_1 wrote:
       | This was my first intro to network programming in school very
       | very long time.
        
       | globular-toast wrote:
       | I've always loved networking and recently implemented an IP stack
       | just for fun. It doesn't take that long to be able to write ping
       | yourself and ping Internet hosts. I was going to go as far as TCP
       | but haven't gone there yet.
       | 
       | I think it's now time to read this and find out all the stuff I
       | got wrong and cement the stuff I got right.
        
         | toast0 wrote:
         | I recently wrote a good enough tcp to layer an http server on
         | top. It's not very good, but I did it, and now I can use
         | someone else's ;)
         | 
         | PS Hello fellow toast
        
           | globular-toast wrote:
           | Hello :)
           | 
           | I'll definitely finish mine one day then. I was more
           | interested in the IP layer when I did mine and learning about
           | routing. TCP seemed a bit too complicated and not that
           | interesting, but it would be cool to have at least once gone
           | from a raw socket to HTTP.
           | 
           | I know exactly what you mean as well. When using technology
           | there is a comfort in knowing that you _could_ conceivably
           | implement it yourself if you absolutely had to.
        
         | the_only_law wrote:
         | Networking is probably one of the parts of computers I've been
         | consistently interested in over the years. I was recently
         | looking at the man page for the addresss_families supported and
         | there's all sorts of crazy stuff that's been adapted to the
         | socket API in there.
         | 
         | I've been working on developing myself a custom ISDN stack
         | recently. So far it's just been me trying to design it at a
         | high level without falling to feature creep.
        
           | globular-toast wrote:
           | I think what I love about it is the Internet is the biggest
           | machine in the world! I can literally flip bits on the other
           | side of the world by pressing some of these buttons here on
           | my desk. After becoming pretty much accustomed to living
           | behind an IPv4 NAT my interest was rekindled when my ISP
           | deployed IPv6 and all of a sudden each device in my house has
           | a real public IP address.
        
       | yrgulation wrote:
       | To anyone writing tutorials or guides, this is the gold standard
       | - at least for me. After many years I still remember writing my
       | first tcp client following this tut. I wish more content would be
       | as focused and concise as this.
        
       | mvh wrote:
       | At Northeastern we use this guide as the canonical "textbook" for
       | the graduate distributed systems course.
        
       | pingiun wrote:
       | > s/he
       | 
       | Just use they, it reads better and includes everyone instead of
       | people with binary genders
        
         | specialist wrote:
         | Agreed.
         | 
         | I've been retraining myself to default to singular they.
         | https://en.wikipedia.org/wiki/Singular_they
         | 
         | Old dog, new tricks. But I'm slowly adapting.
        
         | _underfl0w_ wrote:
         | I've also personally never understood the slash syntax. Since
         | one word requires the "s" and the other doesn't, shouldn't we
         | use parentheses like when words may or may not be plural? e.g.
         | "(s)he" like you might say "socket(s)" or "Unix(es)"?
         | 
         | Moot point if it doesn't solve the issue of it still being
         | binary, I guess.
        
         | dragonwriter wrote:
         | Ironically, with "they" becoming a more common specific-
         | individual-identity-pronoun preference, it is at risk of losing
         | its inclusivity, and of becoming as problematic for unknown
         | individual preference as she and he.
         | 
         | But that's a problem for the future, right now "they" is
         | usually the best inclusive pronoun available.
        
       | known wrote:
       | https://beej.us/guide/bgipc/html/multi/index.html is also good
        
       | sandes wrote:
       | download as pdf
       | https://buzon.io/downloads/75e686f94e1d4a599f2ee9ad521123865...
        
         | _underfl0w_ wrote:
         | Or you can get it from the official source [0] and not some PDF
         | on a file sharing site linked from an HN comment.
         | 
         | [0] https://beej.us/guide/bgnet/
        
       | yakubin wrote:
       | Socket programming never clicked for me before I learned about
       | the protocols themselves first. My brain just rejected using an
       | API for something I didn't understand. So if you're like me, I
       | highly recommend reading Comer's "Internetworking with TCP/IP"
       | first, and sitting down to socket programming later.
        
         | frr149 wrote:
         | That's three volumes... Anything shorter you can recommend?
        
           | great_wubwub wrote:
           | You really only need the first one.
        
           | gnfargbl wrote:
           | Volume 1 of TCP/IP Illustrated by W. Richard Stevens is a
           | good one. If you're very pressed for time, start with the
           | picture of the TCP state machine and work outwards.
        
         | astrobe_ wrote:
         | Maybe it's just me but it took a long time before I found
         | another "big" API as horrible as BSD sockets is.
         | 
         | Well, some APIs are not meant to be used directly, but hidden
         | behind a class or more application-specific functions.
        
       | zubspace wrote:
       | How do you handle servers, which need to be accessible by
       | desktop, mobile and web application?
       | 
       | Can I use those low level API's or do you know some server/client
       | libraries which simplify this for UDP and TCP channels?
        
         | TheCoelacanth wrote:
         | That is covered[1], though it is outdated if you want it to be
         | able to handle as many connections as possible in a fast way.
         | 
         | There are also thousands of higher-level libraries that would
         | let you avoid having to deal with these lower-level APIs
         | directly.
         | 
         | [1] https://beej.us/guide/bgnet/html/#poll
        
         | ColinWright wrote:
         | Your question is insufficiently specific ... it could mean
         | nearly anything. You need to be clearer about what equipment
         | you have, and what you're trying to accomplish.
         | 
         | As it stands, I don't think anyone can answer except it a
         | completely generic way:
         | 
         | Almost every system has libraries to help, but it depends on
         | what you're running on, what you're running over, and what
         | you're trying to do.
        
       | trillic wrote:
       | Beej's guide got me through my networking class in college. As a
       | result I actually understand networking. Thank you Beej!
        
       | dirkf wrote:
       | Can confirm this is a nice introduction to network programming;
       | it's how I got started. Once you know the basics you can switch
       | to the man pages for more details.
        
       | petejames wrote:
       | Beej is a Lambda School instructor. He taught me CS.
        
         | legerdemain wrote:
         | Wait... the Lambda School that's constantly on HN for its
         | disgruntled students, questionable success rates, and murky
         | financials? What possessed beej to associate his name with
         | them?
        
       | teleforce wrote:
       | If I remember correctly this network programming tutorial has
       | been around for more than 20 years now, how times flies!
       | 
       | If you want a cross platform network programming guide in C,
       | Lewis Van Winkle has written an excellent reference book[1].
       | 
       | [1]https://www.amazon.com/Hands-Network-Programming-
       | programming...
        
         | justin66 wrote:
         | If that book is as good as you say, it's a pity he published
         | with Packt. Their stuff is typically very bad.
        
           | mrozbarry wrote:
           | Agreed. I published a video course through Packt and the
           | whole experience was absolutely awful.
        
             | netule wrote:
             | I began writing a book for them in 2010 and quit when the
             | goalposts kept being moved and had a different point of
             | contact every week. Absolutely terrible experience.
        
       | majke wrote:
       | I attempted to write something for more advanced audience. Not
       | sure if it's a successful attempt though...
       | 
       | https://idea.popcount.org/2019-11-06-creating-sockets/
       | 
       | https://idea.popcount.org/2019-12-06-addressing/
        
       | atulvi wrote:
       | I printed this from an internet cafe long back when I didn't have
       | internet at home in India. I wanted to learn about sockets
       | however I could.
        
       | Rebelgecko wrote:
       | Beej's guide is great and still very relevant today (at least if
       | you're programming in C). Are there any equivalent
       | documentation/tutorials for other domains? An equivalent for
       | machine learning would be great, although part of what makes
       | Beej's guide timeless is that a lot of the underlying concepts
       | and syscalls have been static for decades.
        
       | LeonM wrote:
       | Back in 2010 I had my first embedded programming job. I needed to
       | do some network programming in C (controlling a PLC over
       | ethernet). My boss at the time told me "just read Beej's guide
       | and you'll be fine". He was right. That system is running 24/7
       | since then.
       | 
       | Good to see that the guide is still being updated.
       | 
       | edit: typo
        
         | wdb wrote:
         | Yes, I used the guide in 2006 I think or it at least looks
         | similar. I had used it to write a little webserver in C to talk
         | between the Flash UI and the internals of the device. Worked
         | well :)
        
         | KuiN wrote:
         | Same here, my first job out of university was network
         | programming on embedded Linux and Beej's guide was an
         | invaluable resource.
        
           | ravingraven wrote:
           | Are you guys me? Exact same story. Network programming on
           | embedded systems. Beej to the rescue.
        
             | friend-monoid wrote:
             | Same here. That book and the Linux api book are just
             | invaluable resources.
        
               | vymague wrote:
               | Which linux api book?
        
               | friend-monoid wrote:
               | The linux programming interface by Michael Kerrisk. It's
               | incredibly good.
        
               | renerthr wrote:
               | I only found this: https://man7.org/tlpi/
               | 
               | Is there any free or low-cost version?
        
               | thinkmassive wrote:
               | That's the high-value version, it's the only legitimate
               | one
        
               | no_wizard wrote:
               | You may be able to get it from your local library via an
               | app like Overdrive[0][1]. Some library programs even have
               | a way for you to get free access to Safari Books
               | Online[2] (I'd say most if not all, in the US at least)
               | 
               | My experience has been that there is rarely a backlog on
               | technical materials like this.
               | 
               | [0]: https://www.overdrive.com/
               | 
               | [1]: Example of for the LA public library of what I mean:
               | https://lapl.overdrive.com/search?query=The+Linux+Program
               | min...
               | 
               | [2]: https://www.spl.org/books-and-media/books-and-
               | ebooks/oreilly...
        
               | renerthr wrote:
               | That's great information, thank you!
        
               | no_wizard wrote:
               | Libraries are like the secret weapon of a learner. I
               | don't know why our industry has such a lack of knowledge
               | about this one! I only recently found out about being
               | able to do this myself
               | 
               | (In some ways, we benefit, since there is little pressure
               | for the large publishers _not_ to offer these kinds of
               | things for free via the library system)
               | 
               | Ancedota (and unrelated to the topic of this thread, but
               | interesting none the less I think):
               | 
               | In California, if you go to a state university (but if I
               | recall correctly this doesn't apply to the University of
               | California system, but the CSU system, if I got my facts
               | straight) they must provide a minimum number of copies of
               | each textbook / reading material _required_ for a class
               | be available via the campus library.
               | 
               | I hardly paid for books once I found this out. I just
               | coordinated with others to make sure it was available
               | when needed. Worked well for me.
               | 
               | I could be hazy on the regulation on this though, it
               | might have just been dumb luck that the two places I went
               | to school had this as a policy, but I remember it being
               | explained as I did above.
        
               | tracyhenry wrote:
               | How does this book compare to Advanced Programming in the
               | Unix Environment? http://www.apuebook.com/about3e.html
        
           | anilakar wrote:
           | Heck, I passed my uni network programming courses thanks to
           | Beej. It also helped tremendously that our professor was a
           | seasoned UNIX programmer and during lectures he actually
           | typed in his own code and ran it.
        
             | dan-robertson wrote:
             | I had a few maths lectures who were highly regarded for
             | turning up and proving things from memory in front of the
             | blackboard. I hadn't really considered that it might be
             | done in CS.
        
               | konjin wrote:
               | The best lecturer I had in maths would screw up the
               | proofs every time from memory, but the way he screwed
               | them up taught me a lot more than if he'd gotten them
               | right.
        
               | renerthr wrote:
               | Did he acknowledge and fix his mistakes? Or it was just
               | you who noticed and fixed them in your mind?
        
               | sjburt wrote:
               | My experience is that they get about 45 minutes into the
               | lecture, realize that there was an error in minute 10 and
               | spend the rest of the period trying to fix it before
               | telling you to check the book for the correct proof.
        
               | dan-robertson wrote:
               | One professor provided scans of his written notes. For
               | one of the theorems in his notes, he'd stated it,
               | attempted to prove it, failed, crossed out the proof and
               | wrote 'QED'. At least he was honest enough to include it!
        
               | dan-robertson wrote:
               | I remember a lecturer of mine having to state and prove a
               | theorem due to Heawood[1]. I think he did it first
               | because the statement was quite unpleasant and not easy
               | to memorise. I found the point of proving things from
               | memory is that to memorise a proof, one must distill it
               | to key ideas with obvious steps in between. This was
               | particularly useful if you might need to reproduce a
               | proof in an exam.
               | 
               | [1] https://en.m.wikipedia.org/wiki/Heawood_number
        
             | endgame wrote:
             | Heck, my uni's network programming course pointed people to
             | Beej's work.
        
         | Person5478 wrote:
         | Same for me only it was mid to late 90's and I was interested
         | in understanding MUD code.
         | 
         | I have fond memories of that guide and it's always a treat when
         | it pops back up.
        
       | vasergen wrote:
       | in case somebody is interested in offline version, there are pdf
       | versions as well https://beej.us/guide/bgnet/
        
       | riffraff wrote:
       | I remember many years ago learning how to use select() with this
       | guide and then use it to speed up some scanning tool I had found
       | on the internet.
       | 
       | It felt incredible that _I_ could do that as someone who had just
       | started programming.
       | 
       | Thank you Beej.
        
         | Koshkin wrote:
         | A couple of observations regarding select(): its use is not
         | limited to sockets; and, quoting Wikipedia, "with the c10k
         | problem, both select and poll have been superseded by the likes
         | of kqueue, epoll, /dev/poll and I/O completion ports."
        
           | the8472 wrote:
           | And now io_uring too.
        
       | strifey wrote:
       | When I TA'ed a course that taught networking fundamentals, I
       | always pointed folks at this guide when they were struggling with
       | assignments. Can't believe that was 8 years ago.
        
       | fctorial wrote:
       | Title should mention it's about linux.
        
         | macksd wrote:
         | Even though some of the API specifics change, the BSD sockets
         | API has been widely copied. It's a pretty decent introduction
         | to the concepts in general.
        
         | petee wrote:
         | Well, anything that'll run gcc. He does include a section for
         | Windows programming for the brave -
         | 
         | - https://beej.us/guide/bgnet/html/#windows
        
         | joelwilliamson wrote:
         | It's useful for any Unix that has BSD sockets, not just Linux.
        
       | icare_1er wrote:
       | This one and "Programming from the gound up" [https://download-
       | mirror.savannah.gnu.org/releases/pgubook/Pr...] are the two
       | bibles i used and often go back to.
        
       | nathias wrote:
       | beej's guides are the best
        
       | quake wrote:
       | I love this guide!
       | 
       | My first job out of university reqiured networking a small Linux
       | device to an FPGA running a UDP stack, with nothing else. I'd
       | never done anything with networking in C before, and this guide
       | just made everything click
        
       | formercoder wrote:
       | Wow I read this in 2006ish. Amazing document to still be around.
        
       | adamnemecek wrote:
       | I've always felt like the hard part of networking isn't the APIs
       | but the threading problems that you will have very soon after you
       | try to write anything serious.
        
       | mwww2 wrote:
       | This is gold! Thank you so much.
        
       | reflexe wrote:
       | I read your guide when i was 14 (translated to hebrew), until
       | now, i have managed to write a functional usermode tcp/ipv4
       | stack, and now in the middle of development of a usermode-based
       | wireless networking device in an international company. You are a
       | big part of it. Thanks.
        
       | cute_boi wrote:
       | After reading Beej Guide I think I find "The Linux Programming
       | Interface" a good book in general to learn about sockets and
       | other linuxy thing etc. Sadly it hasn't been updated since 2010.
        
       | macksd wrote:
       | This "Beej" fellow is a legend. This is an example of very clear
       | documentation that scales well with your level. When I was
       | learning C/C++ as a teenager, I found the guides to be very
       | accessible. They were recommended _all the time_ to people asking
       | questions on cprogramming.com forums. As I 've referred back to
       | them as a professional I still find them comprehensive and
       | helpful. This is an excellent model and level of quality for
       | other technical writers to aim for.
       | 
       | Brian Hall: thank you!
        
       | anonu wrote:
       | I think this thing has been around for at least 15 years. Glad to
       | see its still being maintained and updated.
        
       | RobRivera wrote:
       | oh hey, I'm actively reworking through this guide for the 3rd
       | time. I always manage to get rusty in the fundamentals after
       | enough time not practicing.
       | 
       | the latest variant is highly digestible. the struct walkthrus
       | seem more accessible
        
       | deckarep wrote:
       | Oh wow, thank you Beej for this work and content! Your resource
       | has been a tremendous reference to many of us myself included and
       | still stands as one of the best resources to network programming
       | today!
        
       | udev wrote:
       | I have special warm feelings for Beej's guide.
       | 
       | I remember particularly enjoying the warm and jovial tone in his
       | guide.
       | 
       | I first read through it some 20 years ago while being a student
       | in an easter-european university, where the tone and style of
       | professors was very "dictatorial", dry, and overly-technical.
       | 
       | Beej's style of exposure was a breath of fresh air, and brought a
       | major realisation for the then young-me, that you can teach
       | complex topics in a friendly manner.
        
         | daotoad wrote:
         | > while being a student in an easter-european university, where
         | the tone and style of professors was very "dictatorial"
         | 
         | I know it's just I typo, but now I have an image stuck in my
         | head of a large rabbit, dressed up like Mussolini, lecturing
         | about computer science.
         | 
         | Beej's guide was so amazingly helpful and welcoming when I
         | found it over a decade ago.
         | 
         | Poorly written guides that try to be friendly or conversational
         | are often worse than dry and terse guides of similar caliber,
         | which really makes me appreciate the good and truly great ones.
         | 
         | And Beej's Guide is a truly great one.
        
       | billfruit wrote:
       | Good guide to socket programming. Does it cover sctp? And more
       | importantly is sctp support part of Kernel/glibc presently?
        
         | ColinWright wrote:
         | https://www.google.com/search?q=site%3Abeej.us+sctp
         | 
         | > Your search - site:beej.us sctp - did not match any
         | documents.
         | 
         | In contrast:
         | 
         | https://www.google.com/search?q=site%3Abeej.us+udp
         | 
         | > About 9 results (0.25 seconds)
         | 
         | So I'd guess that the guide doesn't cover sctp.
         | 
         | ========
         | 
         | Then:
         | 
         | https://duckduckgo.com/?q=is+sctp+support+part+of+Kernel%2Fg...
         | 
         | Returns:
         | 
         | > https://www.kernel.org/doc/html/latest/security/SCTP.html
         | 
         |  _(and more ...)_
        
           | billfruit wrote:
           | That discussion of merging sctp functionality into glibc is
           | from 2004. Anyone knows what happened after that?
        
         | jcrubino wrote:
         | sctp only be came widely available after websockets and I think
         | due to data channel implementations in WebRTC.
        
       ___________________________________________________________________
       (page generated 2021-02-11 23:00 UTC)