Search code examples
network-programmingtelecommunication

How does a computer know what data to reassemble?


When a computer X sends data through a network to computer Y the data goes down through the OSI layer. This is ok. I understand. But once the data is put on the media as eletric signals then how does the computer Y know what to reassmble, given the headers and trailers of the data model generated in OSI, once it is put on the electric media at layer 1 does not exist any more?


Solution

  • The physical layer is just 1's and 0's as you say - the trick is that there is a pattern that tells the receiver that this is the start of a packet. This is usual referred to as 'Framing'.

    Once the receiver knows that, it simply reads in as many bits as its needs for the Layer 2 header and it then has that and so on.

    The headers are clear in a typical OSI or networking diagrams, e.g. (https://www.ciscopress.com/articles/article.asp?p=2738463):

    enter image description here

    So the way the first two layers work on the receiver is:

    • layer 1 just recognises whether the signal is a one or a zero and creates the stream of ones and zeros.
    • layer 2 reads this stream and when it recognises the start pattern it then know the following bits are the header and so on and hence it can identify the frames.

    You can see examples of start and stop patterns online e.g. (http://sinauonline.50webs.com/Cisco/Cisco%20Exploration%20Sem1Chap7.html):

    enter image description here