[HN Gopher] Beej updated the classic Linux network programming g... ___________________________________________________________________ Beej updated the classic Linux network programming guide Author : matt321 Score : 266 points Date : 2022-07-20 13:10 UTC (9 hours ago) (HTM) web link (beej.us) (TXT) w3m dump (beej.us) | synergy20 wrote: | It's released in Nov,2020 but yes it's one of the best. | biohax2015 wrote: | Do we need to know C to use this? | tempusr wrote: | It uses the gcc compiler so C, or C++ can be applicable. | | That being said, this book teaches network programming from the | ground up so I would recommend understanding how to compile and | output C code, then go through the book. | | If you run into keywords, or syntax that you are not familiar | with, just google it, and then keep working through the | examples. | | Mind you, the key takeaways from this book are not how to | network practice IN C, but general practices. This knowledge | can be applied to plenty of other languages such as Rust. | gre wrote: | You can learn C at the same time. | lprd wrote: | Besides the classic C book by K&R, what are some more modern | C books that the HN community vouch for? | shric wrote: | I think C Programming: A Modern Approach by K.N. King is | great. | jamal-kumar wrote: | Has anyone actually even tried the K&R book in the past | couple of decades and not run into issues like the | assumption of unbuffered shell output? You get like one or | two chapters in and things are already behaving outside of | how they did when that book was written in the 1980s. It's | a classic, yes, but I don't recommend it to anyone outside | of people writing code in C89 for vintage systems... Yet | the amount of suggestions I see from people who haven't | actually learned C from scratch since the 1990s to read | that particular title is high enough that I can't do | anything but scratch my head over it. Tons has changed over | thirty plus years. | | If you're looking for something up to date I'd recommend | this: | | https://gustedt.gitlabpages.inria.fr/modern-c/ | emmelaich wrote: | K&R2 is hard to beat for size and clarity of writing. | | Could you elaborate on the "unbuffered shell output" | comment? | gre wrote: | My favorite C programming book was Expert C Programming by | Peter van der Linden, mainly for the method of reading any | C declaration and for teaching me the difference between | libc calls vs syscalls. There's also a book called Modern C | by Jens Gustedt from 2020 that I have and is more beginner | friendly. | | The way I learned C is I printed out the Beej's guide | client/server code and walked around staring at it until it | made sense. (That and compiling/running it and looking up | functions in the man pages.) | macintux wrote: | _Expert C Programming_ is brilliantly written. I recently | bought another copy because I lost mine; I don't actually | need it, but it's a fun read regardless. | beej71 wrote: | I did write a guide to C that's currently in beta. If it's | any good or not... Well, I'll leave that up to you. :) | | I also really like K&R2 and Van der Linden. | | https://beej.us/guide/bgc/ | lprd wrote: | I'll most definitely be checking out your guide! Thank | you so much for your contributions in the community :) | Will the latest revision of your Networking Guide be | available on print any time soon? I'd love to buy a copy. | jey wrote: | No, not necessarily. You can use these APIs directly from many | different languages. For example, Python has 'socket'[1], Ruby | has 'socket'[2], Julia has 'Sockets'[3], PHP has 'socket_*'[4]. | | 1. https://docs.python.org/3/library/socket.html | | 2. https://ruby- | doc.org/stdlib-2.5.3/libdoc/socket/rdoc/Socket.... | | 3. https://docs.julialang.org/en/v1/stdlib/Sockets/ | | 4. https://www.php.net/manual/en/ref.sockets.php | freedomben wrote: | I went through a ton of linux socket tutorials that were in C | using that Ruby Socket library. Highly recommend! | | Edit: This is a more up to date link. I don't think the | library has changed since 2.5.3, but I usually try to look at | latest documentation: https://ruby- | doc.org/stdlib-3.1.2/libdoc/socket/rdoc/Socket.... | jsd1982 wrote: | Not necessarily but it does help. These tutorials focus mainly | on the Berkeley Sockets API which can be exposed as-is (or with | slight modification) to many languages beyond just C/C++. | astrobe_ wrote: | It is useful _mainly_ if you have to do some netprog in C, and | secondarily if you have to deal with language bindings that do | a 1:1 mapping to the BSD socket API. | | In other words, you will know when you need it - unless you | forget it exists (note: bookmarking it might be a good idea, | cause you could remember something like this exists but "what | was the name again?"). | srathi wrote: | > fork() takes no arguments, and CreateProcess() takes about 48 | billion arguments. | | I chuckled! | RJIb8RBYxzAMX9u wrote: | Jokes aside, it's more apt to compare CreateProcess() with | posix_spawn()[0]. | | [0] | https://pubs.opengroup.org/onlinepubs/009695399/functions/po... | robalni wrote: | The weirdest thing just happened. I was on https://beej.us/guide/ | and I removed the last part of the URL to make it only | https://beej.us and I pressed enter. This took me to cnet.com. I | have never been on cnet.com before. I have no idea how this | happened. Does anyone have a clue? I'm using Firefox if that | matters. Did a web server somewhere get hit by a cosmic ray or is | beej's server infected by something? This is super weird. When I | try to do it again it just takes me to beej's site as expected. | bruce343434 wrote: | bit flip? | jsd1982 wrote: | Hm, unable to reproduce. Perhaps you have some weird browser | extension installed or something intercepting DNS requests? | pronoiac wrote: | I couldn't reproduce, but I note the background image changes | on reloads. Perhaps beej is hotlinking, and one of the images | is based on cnet, who redirected to themselves? | beej71 wrote: | Maybe CNET is offering me large sums of money to randomly | redirect every hundredth visitor! | | Actually, they're not, so this is weird. I can't repro, and | ripgrep tells me "cnet" doesn't appear in my web pages | anywhere. | | If you find it, I'd love to know what it is. | lprd wrote: | I've yet to break into this one (I've seen it recommended so many | times on HN). I'm no network engineer, but networking is a lot of | fun for me and I enjoy learning about how it all works. High | Performance Browser Networking[0] was one of my favorite books on | this topic. Very approachable, even to complete beginner. I | suspect that Beej's guide is a bit more low level and I look | forward to that! | | [0]https://hpbn.co/ | adamch wrote: | I think HPBN and Beej's guide are perfect companions to each | other. They've been the most useful resources on my journey to | learn more about networking. | metadat wrote: | Can you link to "HPBN"? I'm not familiar with what this | initialism.. | aaaaaaaaata wrote: | See GP comment. | beej71 wrote: | Hey all! | | I did update it for IPv6, but that was several years ago. | | So I'm not sure which update the OP is referring to. | | Appreciate the kind words, though! | p4bl0 wrote: | Hey! Thank you so much for your networking guide! It's my go to | reference for socket programming and it is the documentation | that I pointed my students to when I was giving a networking | course :). | | Not directly related but while you're here: you should _really_ | add Marcus Rediker's _Villains of all nations_ to your Pirates | reading list. I highly recommend it! It 's the best pirates' | book ever =). | melony wrote: | Any plans to add support for the new async and zero copy APIs? | 29athrowaway wrote: | Mr. @dang, I would like to kindly request that the title is | updated. | shitlord wrote: | Thank you for writing this guide. I really enjoyed reading it | and it helped me get my first job. | matt321 wrote: | I just pulled it up to refresh my knowledge for a project and | it was different. The thing that sticks out the most being | different is that the code boxes are highlighted. My first time | reading, it was standard grey boxes similar to some other guide | (IPC guide I just read was still grey boxes!). Great work! It's | the best reference! | micheljansen wrote: | Your guides were legendary when I was just starting out. Thanks | for that! | dceddia wrote: | Thank you so much for this guide! | | When I was a kid, socket programming felt like a huge thing to | me, like _unlocking the next level of programming_. "Imagine | if I could get 2 separate computers to talk to each other!" But | it felt impenetrable, and used lots of weird and confusing C | tricks. | | Your guide demystified the whole subject and put it in plain | language that teenage me could understand, and with it, I was | able to build my first network-based "hello world". It was a | magical feeling to see those messages delivered across the | network. Thanks Beej! | matt321 wrote: | >> socket programming felt like a huge thing to me, like | unlocking the next level of programming. | | This was my story as well, I wonder how many people have been | through this just like us!? | mattgreenrocks wrote: | Thanks for your work on this. I read it when I was much younger | and it hammered home how to treat stream sockets correctly. | metadaemon wrote: | The IPv6 update really helped me at work, thank you!! | x-n2o wrote: | Wow unreal... I used your guide years ago for my first project | when I was learning C. It was an IRC bot. | | Thank you! | kif wrote: | Your tutorial demystified network programming for me when I was | just a kid. It deserves all the praise it gets. Thank you! | mistertester wrote: | Thanks Beej been using your guides for a long time. Appreciate | your hard work! | danw1979 wrote: | Beej: thanks a million ! I learnt all about sockets and | select() from your guide back at uni over 20 years ago. I was | trying to make an autonomous model helicopter for my 3rd year | project, fuel oil powered, with a scarily large rotor | diameter... so I made this single threaded emergency stop | daemon that listened to a few sockets, including the big red | button, which would interrupt the test joystick data and write | out some engine-off and neutral collective pitch commands | instead. | | And yes, it worked in a real emergency ! the heli didn't have | any rotors afterwards but we still had our heads. | | So I guess you maybe saved my life ? | jackdaniel wrote: | Hey! I've learned network programming with your guide when I | was teenager - thank you! | squarefoot wrote: | Thanks for your hard work! When I discovered your guides ages | ago I already had digested a good part of the famous text by W. | Richard Stevens, but being my copy a very poorly translated | edition (I did read English back then, but the imported book | would cost a small fortune), I later had to check some things | on your guides for consistency, so they turned out very useful | anyway. | booboofixer wrote: | I work in networking, probably because of 1. Your guide and 2. | My professor. Thanks | silisili wrote: | Thank for for writing and maintaining this for so long. As I | wrote yesterday, it is my single favorite piece of programming | literature in existence. | jjice wrote: | Beej's Networking guide is probably the funniest software book | I've ever read. There are parts in there that actually get me to | laugh aloud. All while being a fantastic intro to sockets. | | Couldn't recommend this more. Free online, plus you can purchase | the paperback now. | bigdict wrote: | What changed? Seems like there was only a minor change 17 days | ago: https://github.com/beejjorgensen/bgnet/commits/master. | billfruit wrote: | Does it cover SCTP/websockets? | JustSomeNobody wrote: | They have some stuff on their blog: | | https://beej.us/blog/data/websockets/ | matt321 wrote: | If you prefer a c implementation: https://libwebsockets.org/ is | pretty standard! | lubesGordi wrote: | Beej reminds me that the people who are the best at what they do, | are having the most fun. | | Thanks for your work Beej! I've referenced your pages many times | over the years. | throwaway5371 wrote: | i dont know what was updated, but just want to say big thanks to | beej | | this guide was what got me into programming years ago | | and i still refer to it from time to time | sp332 wrote: | Finally mentions poll() and not only select() ! | Sardtok wrote: | IIRC it did that 10 years ago as well, back when I read it for | an intro class to C, OS principles and networking. | alexchro93 wrote: | Indeed, this guide is very informative and easy to digest. It's | practically required reading for anyone taking CS 6200: | Introduction to Operating Systems [1] in Georgia Tech's Online | Master of Science Computer Science program. | | Thank you, Beej. Looking forward to reading this again today. | | 1. https://omscs.gatech.edu/cs-6200-introduction-operating- | syst... | itsmemattchung wrote: | Truly an instrumental resource for getting through Operating | Systems course at Georgia Tech. ___________________________________________________________________ (page generated 2022-07-20 23:00 UTC)