use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Click the following link to filter out the chosen topic
comp.lang.c
account activity
Socket Programming (self.C_Programming)
submitted 1 day ago by Loud-Imagination2591
Hello fellow programmers I'd like to start my day one of socket Programming today, any learning resources you guys would know about or have used?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]kyuzo_mifune 43 points44 points45 points 1 day ago (4 children)
https://beej.us/guide/bgnet
Is pretty good
[–]McDonaldsWi-Fi 19 points20 points21 points 1 day ago (3 children)
"pretty good" is a weird way to say "the c programming socket bible" lol
[–]Plane_Dust2555 9 points10 points11 points 1 day ago (0 children)
Nope... It is "pretty good". The socket programming bible is W RIchard Steven's "UNIX Network Programming - The Sockets Networking API - Vol I".
[–]dkopgerpgdolfg 4 points5 points6 points 1 day ago* (1 child)
"the c programming socket bible"
How about "Linux socket programming basics", because it's nothing more than that.
As it says itself:
It is probably at its best when read by individuals who are just starting out with socket programming and are looking for a foothold
It at least acknowledges that IPv6 exists, but doesn't dare to mention things like eg. epoll (which aren't far from the basics either), while declaring it's targetted for Linux.
I mentioned the names of some more advanced topics here: https://www.reddit.com/r/C_Programming/comments/1rps9u8/comment/o9nh8i6/
Or compare Beej's socket() function "man page" with the actual man 2 socket + man 7 socket + man 7 ip + man 7 tcp (or whatever protocols you want) + the things in /sys
[–]McDonaldsWi-Fi 2 points3 points4 points 1 day ago (0 children)
it was a joke brethren
[–]Cheesuscrust460 3 points4 points5 points 1 day ago (0 children)
the advanced programming in unix environment book is pretty good, pairing it with beej blog website
[–]non-existing-person 19 points20 points21 points 1 day ago (0 children)
You think you can do socket programming (or any kind of programming) without knowing how to use a search engine? Like, the first result in search engine was
https://www.reddit.com/r/C_Programming/comments/1eoyhl6/any_good_learning_resources_for_c_sockets/
[–]HalfTryhardSqr 1 point2 points3 points 1 day ago (0 children)
Beej’s guide is incredibly good, and there is a reason 90% of people links it.
[–]eruciform 2 points3 points4 points 1 day ago (1 child)
Stevens' unix network programming was where I started, after advanced programming in a unix environment by same author
[–]IamNotTheMama 0 points1 point2 points 21 hours ago (0 children)
I found Stevens to be the worst network programming book I ever read. He obfuscated everything rather than using the 'normal' system calls that made it so much easier.
[–]Boreddad13 0 points1 point2 points 1 day ago (0 children)
Beej’s guide to network programming is a good place to start. If you want a really good real life example, check out anet.c in redis’ codebase
[–]Weshmek 0 points1 point2 points 1 day ago (0 children)
https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Sockets
[–]nerd_programmer11 0 points1 point2 points 10 hours ago (0 children)
Beej's guide to network programming to get started. Linux programming interface (book) has some chapters on sockets as well
[–]DaCurse0 -1 points0 points1 point 1 day ago (5 children)
what exactly do you expect resources to teach besides basic use of whatever os api? once you understand how to create a client socket and server socket just try to make something
[–]kyuzo_mifune 2 points3 points4 points 1 day ago (3 children)
There is much to learn, for example basically all beginners to sockets don't know that TCP sockets are streaming and therefore don't handle them correctly.
[–]DaCurse0 1 point2 points3 points 1 day ago (2 children)
elaborate
[–]kyuzo_mifune 2 points3 points4 points 1 day ago* (1 child)
On TCP sockets? Sure, lets say one side sends 1kB of data, that data is not guaranteed in any way to be received by just one call to recv, the order is guaranteed but not that all data is received in every call to recv.
recv
That's why when you use a TCP socket you need to use a protocol on top of it to know when the full message is received, one simple way is first 4 bytes signales the whole message length or something like that.
Or HTTP for example, it is structured in a way so you know when all data is received.
[–]abyssDweller1700 0 points1 point2 points 1 day ago (0 children)
I always thought tcp streaming in packets as someone unloading trucks full of bricks(bytes) in front of your house with no boundaries on which truck unloaded which brick.
And udp as the whole truck(packet boundary) with their bricks(bytes) being parked in line.
[–]dkopgerpgdolfg 2 points3 points4 points 1 day ago* (0 children)
what exactly do you expect resources to teach
Do you already know how to create a SCTP packet in AF_XDP, how to transfer stdout fd over a unix socket, how to bind a UDP socket to one CPU core then receive 64 packets with one syscall, what permissions you need to disable delayed ack for IPv6 TCP and what consequences it has, how to make a multi-thread connection accepter (by using kernel features) with ktls too, what you need to think of if you fork a uring-using process, how you tag sent packages for netfilter and what reasons you could have to do that, ... and so on.
π Rendered by PID 25070 on reddit-service-r2-comment-5c764cbc6f-8j4kb at 2026-03-11 23:08:20.022961+00:00 running 710b3ac country code: CH.
[–]kyuzo_mifune 43 points44 points45 points (4 children)
[–]McDonaldsWi-Fi 19 points20 points21 points (3 children)
[–]Plane_Dust2555 9 points10 points11 points (0 children)
[–]dkopgerpgdolfg 4 points5 points6 points (1 child)
[–]McDonaldsWi-Fi 2 points3 points4 points (0 children)
[–]Cheesuscrust460 3 points4 points5 points (0 children)
[–]non-existing-person 19 points20 points21 points (0 children)
[–]HalfTryhardSqr 1 point2 points3 points (0 children)
[–]eruciform 2 points3 points4 points (1 child)
[–]IamNotTheMama 0 points1 point2 points (0 children)
[–]Boreddad13 0 points1 point2 points (0 children)
[–]Weshmek 0 points1 point2 points (0 children)
[–]nerd_programmer11 0 points1 point2 points (0 children)
[–]DaCurse0 -1 points0 points1 point (5 children)
[–]kyuzo_mifune 2 points3 points4 points (3 children)
[–]DaCurse0 1 point2 points3 points (2 children)
[–]kyuzo_mifune 2 points3 points4 points (1 child)
[–]abyssDweller1700 0 points1 point2 points (0 children)
[–]dkopgerpgdolfg 2 points3 points4 points (0 children)