[HN Gopher] Beej's Guide to Network Programming (1994-2023)
___________________________________________________________________
Beej's Guide to Network Programming (1994-2023)
Author : fdeage
Score : 154 points
Date : 2023-10-11 10:43 UTC (5 hours ago)
(HTM) web link (beej.us)
(TXT) w3m dump (beej.us)
| ajdude wrote:
| I think anyone who wants to get into network programming, even if
| they don't plan on doing it in C, should read this. It's what
| helped things finally "click" well over a decade ago when I first
| read it.
| denton-scratch wrote:
| Section 1 is _all_ preamble, disclaimers, and stuff that would
| normally appear at the bottom of an article, rather than the top.
|
| I recommend you start reading at section 2.
| tiffanyh wrote:
| I didn't realize this guide was still being maintained and
| updated.
|
| It's one of the resources to learn networking.
| mananaysiempre wrote:
| The author also occasionally comes here:
| https://news.ycombinator.com/user?id=beej71
| irl_ wrote:
| When I read this through 25 years ago I learned more about
| networking than I think I knew in total up until that point, and
| that was nearing the end of an A level (English further
| education) Computing course. It's a really comprehensive guide
| that laid it out exactly the way I needed it for me to absorb it.
| I still recommend it to people that might be new to network
| programming as the sockets API really doesn't change that much
| whether you're using C or Python or some other language.
| jjice wrote:
| I'll never not recommend this book. Fantastic and free, but you
| can get an official paperback book these days too. It's well
| written if you want to learn basic networking with the BSD
| sockets API. It's also the funniest software book I've ever read.
| A lot of programming book authors have some charm to their
| writing, but Beej is on another level.
| PH95VuimJjqBqy wrote:
| I came into the thread to comment I'll never not smile when I
| see beej's guide pop up.
|
| back in the late 90's/early aughts it was absolutely the best
| way to learn network programming using BSD sockets. It
| originally picked it up to better understand circlemud code in
| college, it will always hold a special place in my heart.
| robotguy wrote:
| I bought a paperback of this many, many years ago and used it
| to write a MUD in C. Good times...
|
| I think maybe I should get a copy of the new version because I
| don't understand IPV6 at all.
| helpfulContrib wrote:
| [dead]
| matt3210 wrote:
| Love it
| jeffwiederkehr wrote:
| This guide was the only resource that made my 400 CS networking
| course material final stick.
| p4bl0 wrote:
| I _love_ this guide! I gave it as a reference to my students when
| I was teaching networks a few years ago. At the time it didn 't
| have IPv6 taken into account! I'm so glad it is the case now,
| especially since I'm going to teach system and network
| programming against next semester =).
|
| The other reference that I really like to give students about
| networks is Michal Zalewski's _Silence on the wire_ [1]. A really
| great introduction that can be read cover to cover -- almost as a
| novel -- despite being really technical.
|
| [1] https://nostarch.com/silence.htm
| pipes wrote:
| Started reading... I'm trying to understand the difference
| between connectionless (datagram sockets) and persistent
| connection (stream sockets).
|
| The thing I've realised is that I don't understand what a
| connection actually is. So I don't understand this bit
|
| "Why are they connectionless? Well, basically, it's because you
| don't have to maintain an open connection as you do with stream
| sockets. You just build a packet, slap an IP header on it with
| destination information, and send it out. No connection needed"
|
| How can anything be sent with no connection? What is a
| connection?
| duniel wrote:
| A connection in the context of TCP is essentially the state
| related to the handshake.
|
| With UDP, you build a packet, slap an IP header on it, and send
| it out in the hopes that the other side receives it.
|
| With TCP, you can't just send data, you have to perform a
| three-way handshake first: send a packet with the SYN flag set,
| receive a SYN-ACK, and if you received a SYN-ACK send an ACK
| back.
|
| Stateful firewalls, for instance, track the connection state
| for Network Address Translation (NAT) or firewalling purposes.
| When a TCP connection is opened (SYN), the connection is
| considered 'new'. After the handshake is completed (SYN-ACK,
| ACK), the state changes to 'established'. The lifetime of the
| connection ends after a TCP packet with the RST or FIN flags
| set, and the state changes to 'closed'.
|
| _Cool, related things to read up on: Linux conntrack, TCP
| reordering and retransmission, Stream Control Transmission
| Protocol (SCTP), Multi-Path TCP (MPTCP), Internet Control
| Message Protocol (ICMP, also known as "ping")._
| macksd wrote:
| I actually remember being a bit confused by this too. Hopefully
| I can help:
|
| These refer to 2 different protocols at the same layer: UDP,
| and TCP. Below these protocols there are layers that route
| little messages around local networks (like Ethernet) and that
| route little messages across the Internet (like IP), and UDP
| and TCP are another layer of abstraction on top of that.
|
| TCP adds information about the ordering of messages, it has a
| mechanism for acknowledging receipt of a message, it has logic
| for resending a message, etc. UDP does not include these
| concepts, so if a message gets lost somewhere in the network,
| an application using UDP might not even notice.
|
| The "connection" in this case, really refers to the state about
| these messages that is kept. It's a virtual / logical
| connection, not a physical connection.
| HDThoreaun wrote:
| I think that's referring to a tcp connection right. Basically
| with UDP you can just start spamming out packet wherever you
| want but TCP requires a bit of setup with the handshake before
| you start sending the actual data. Networking definitely gets
| confusing with the billion different layers of connections.
| aidenn0 wrote:
| A TCP connection is a virtual connection. The two sides of the
| connection maintain state and use this to turn packets into a
| stream of data. Since IP doesn't guarantee delivery at all,
| much less in-order delivery, this requires some work, and
| maintaining state on both ends.
|
| UDP is a stateless protocol. If you listen on port 12345, you
| will get every packet that comes in on port 12345. Some packets
| sent won't make it, others might arrive twice, others might
| arrive out-of-order.
| rramadass wrote:
| If you want to learn and understand Computer Networking i
| highly recommend the following book;
|
| _An Engineering Approach to Computer Networking : ATM
| Networks, The Internet, and The Telephone Network by S.Keshav_
| say_it_as_it_is wrote:
| That book was published in 1997. I'm sure it was valuable at
| the time that it was studied but come on.
___________________________________________________________________
(page generated 2023-10-11 16:01 UTC)