9 ms·
Beej updated the classic Linux network programming guide
- synergy20 4y agoIt's released in Nov,2020 but yes it's one of the best.
- sp332 4y agoFinally mentions poll() and not only select() !
- Sardtok 4y agoIIRC it did that 10 years ago as well, back when I read it for an intro class to C, OS principles and networking.
- biohax2015 4y agoDo we need to know C to use this?
- tempusr 4y agoIt 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.
- jsd1982 4y agoNot 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_ 4y agoIt 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?").
- gre 4y agoYou can learn C at the same time.
- lprd 4y agoBesides the classic C book by K&R, what are some more modern C books that the HN community vouch for?
- gre 4y agoMy 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 4y agoExpert 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 4y agoI 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/ https://beej.us/guide/bgc/
- lprd 4y agoI'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.
- shric 4y ago
- jey 4y agoNo, 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 https://docs.python.org/3/library/socket.html 2. https://ruby-doc.org/stdlib-2.5.3/libdoc/socket/rdoc/Socket.html https://ruby-doc.org/stdlib-2.5.3/libdoc/socket/rdoc/Socket.... 3. https://docs.julialang.org/en/v1/stdlib/Sockets/ https://docs.julialang.org/en/v1/stdlib/Sockets/ 4. https://www.php.net/manual/en/ref.sockets.php https://www.php.net/manual/en/ref.sockets.php
- freedomben 4y agoI 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.html https://ruby-doc.org/stdlib-3.1.2/libdoc/socket/rdoc/Socket....
- robalni 4y agoThe weirdest thing just happened. I was on https://beej.us/guide/ https://beej.us/guide/ and I removed the last part of the URL to make it only https://beej.us 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.
- jsd1982 4y agoHm, unable to reproduce. Perhaps you have some weird browser extension installed or something intercepting DNS requests?
- pronoiac 4y agoI 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 4y agoMaybe 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.
- bruce343434 4y agobit flip?
- billfruit 4y agoDoes it cover SCTP/websockets?
- JustSomeNobody 4y agoThey have some stuff on their blog: https://beej.us/blog/data/websockets/ https://beej.us/blog/data/websockets/
- matt321 4y agoIf you prefer a c implementation: https://libwebsockets.org/ https://libwebsockets.org/ is pretty standard!
- alexchro93 4y agoIndeed, 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-systems https://omscs.gatech.edu/cs-6200-introduction-operating-syst...
- itsmemattchung 4y agoTruly an instrumental resource for getting through Operating Systems course at Georgia Tech.
- bigdict 4y agoWhat changed? Seems like there was only a minor change 17 days ago: https://github.com/beejjorgensen/bgnet/commits/master https://github.com/beejjorgensen/bgnet/commits/master.
- matt321 4y agoSignificant change to include highlighting and formatting versus 5 years ago
- lprd 4y agoI'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/ https://hpbn.co/
- adamch 4y agoI 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 4y agoCan you link to "HPBN"? I'm not familiar with what this initialism..
- aaaaaaaaata 4y agoSee GP comment.
- beej71 4y agoHey 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!
- kif 4y agoYour tutorial demystified network programming for me when I was just a kid. It deserves all the praise it gets. Thank you!
- mattgreenrocks 4y agoThanks for your work on this. I read it when I was much younger and it hammered home how to treat stream sockets correctly.
- booboofixer 4y agoI work in networking, probably because of 1. Your guide and 2. My professor. Thanks
- squarefoot 4y agoThanks 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.
- silisili 4y agoThank for for writing and maintaining this for so long. As I wrote yesterday, it is my single favorite piece of programming literature in existence.
- jackdaniel 4y agoHey! I've learned network programming with your guide when I was teenager - thank you!
- dceddia 4y agoThank 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!
- srathi 4y ago> fork() takes no arguments, and CreateProcess() takes about 48 billion arguments. I chuckled!
- RJIb8RBYxzAMX9u 4y agoJokes aside, it's more apt to compare CreateProcess() with posix_spawn()[0]. [0] https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html https://pubs.opengroup.org/onlinepubs/009695399/functions/po...
- lubesGordi 4y agoBeej 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 4y agoi 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
- matt321 4y agoThe last time I looked about 5 years ago it was formatted way different. Now has code boxes with highlights and easier to read.
- jjice 4y agoBeej'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.
- bitwize 4y agoMan, this is so cool -- an old-school programming resource that isn't encrusted with ads and trackers, just the information you want in HTML format. Kenton Lee's X programming guide was another such resource, but sadly that appears to have been eaten by the internet Langoliers.
- bfrog 4y agoWhen's the next update to cover io_uring?
- nickzelei 4y agoJust wanted to say thanks. Your guides saved me during my OS/Networking class a few years back.