1
Bubbles
4y

Anyone with good understanding of hardware and/or an operating systems network protocols please assist me. I have questions

When using socket api I know it’s not the actual sockets sending the data but the socket api tells the network protocol to send, receive, listen, connect, etc well what I want to know is how that networking protocol works within the operating system

My second question is more an extension of the first. After the operating system knows what the socket api wants to do and wants to do it how does the transmission and receiving work on the physical layer within the hardware

Idk if what I’m asking makes sense. But if anyone also has any resources or a link that’ll help me on the subject I’d appreciate it. I haven’t found anything on the subjects myself

Comments
  • 1
    Not sure about the first question, but for the second question it all comes down to the multilayer architecture of networks. The physical layer is only concerned with sending individual bits and receiving them. But other than when demuxing occurs the physical layer doesn't know which protocols are used above it. One layer doesn't know about the abstractions used by the layers above it. So the physical layers has no knowledge of the sockets being used at the transport layer.

    That is the beauty of these abstractions. Each layers builds on the layers below it without having to know the internals of how they function.

    Hope this helps.
  • 1
    @crow22498 okay a follow up, how does the hardware in the physical layer send/receive the bits?
  • 1
    @Bubbles that depends. At this layer it's basically the nitty gritty encoding of bits as signals onto a medium. So basically lowering or increasing the voltage. But to keep the clock synchronized for both the sender and receiver you need to use something like Manchester encoding since simply using high and low to indicate 0 and 1 can lead to problems when you have many of the same bits after each other.
  • 1
  • 0
    @Bubbles are you building something that requires a lot of low level networking
  • 1
    @crow22498 no not at the moment I’m just incredibly interested in how it all works. Lower level stuff fascinates me
  • 0
    @Bubbles networking is quite fascinating. And compared to some other low level computer science things it's actually quite tangible and easy to understand. If you ever wonder how a protocol works just look up the RFC for.
  • 1
    @crow22498 I’ll definitely look into it thanks!
  • 1
    On radios it's even more interesting and you need some math
  • 1
    @electrineer yeah signal processing gets complicated really quick when you stop using wires. And don't even get me started on wireless collision detection
  • 1
    Might I recommend Ben eaters videos on the subject
  • 3
    'OSI layer model' are good search keywords for learning more about this layering approach and what is being done in which layer.

    The lowest HW layer is the PHY (physical) layer, and the OS itself doesn't do anything here. That is baked into some chips, e.g. an ethernet chip on the mainboard. The OS just gives some settings to the chip, writes data to the chip, and reads data from the chip.

    The chip then makes sure that all the electrical things are done on the medium (e.g. the ethernet cable) and implements the PHY protocol layer. That is encoding, and also some media arbitration logic like CSMA/CD (search engine) for ethernet.
  • 2
    @Bubbles you could try going through a networks textbook like Tannenbaum's if you're interested in the details. He doesn't go all that deep into physical layer though (but he does provide surface level explanations), that's hardcore signal processing and communications engineering, you need a fair amount of study for that. They're fascinating fields though and totally worth it.
  • 2
    @Fast-Nop I guess I’ll have to go more in depth of the osi model.

    @RememberMe thanks I’ll definitely try to find some and read them!

    @terraria99 I love Ben Eaters he’s such a good resource and overall intelligent person
  • 2
    @Bubbles The OSI model is also helpful for troubleshooting and debugging. You will usually go bottom-up until you find the layer where things don't work, and at the same time making sure that everything below is OK.

    Since systems are mostly architected along the OSI model, that alone will narrow down the scope where the problem could hide.

    This in turn allows you to skip vast parts of the codebase because the fastest way of going through code is making sure you don't have to read it.

    On the other hand, you could waste endless hours of reading code when the problem is a loose soldering contact, or that rats have eaten a cable (no shit, that does happen).
  • 1
    @Fast-Nop I know of and what the OSI model is I just haven’t studied it in detail, do you recommend any particular resource on it?
  • 1
    @Bubbles I would just start out with Wikipedia. The scripts I had during my studies won't be available anyway. If they even still exist. :-)
  • 1
    @Fast-Nop is Wikipedia accurate though my entire life I’ve been told by everyone to avoid it for serious work
  • 3
    @Bubbles Correct, but one of the main difficulties many people have in learning is not seeing the forest for the trees. It's better a learning strategy to first get an overview and then fit the details in than first diving into the details and trying to derive the bigger picture from that, and be completely overwhelmed.
Add Comment