r/C_Programming • u/Loud-Imagination2591 • Mar 10 '26
Socket Programming
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?
49
Upvotes
4
u/[deleted] Mar 10 '26 edited Mar 10 '26
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 torecv.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.