Switch – How Do Data Packets Travel Without Merging?

ethernetlayer1protocol-theoryswitchtransport-protocol

I have been very interested in networking for quite a while, and I have been wondering this question. I've been thinking about this in complete binary, meaning how does a 0 of a data packet not get interfered by a 1? For example, if two data packets are somehow sent at the same time, how do they not merge if one packet is (of course not this short) 101101 and another is 011010? How does it now become 111111 and mess everything up? This also brings up how the validation of a packet header is used, as that I am also confused about too. Is it just based on how instant these packets of data are sent and that it's almost impossible for multiple to send at the same time? I hope this isn't too confusing, but I would be happy if someone could broadly explain this. Thank you

Best Answer

You are describing a problem called collision. There are different network media and protocols that are subject to collision, and the protocols must have a method to detect when that happens. Your question is really too broad to go into details, and those will vary with the medium and protocol, but I will give you some information.

The original ethernet was on a shared medium (coax cable) where more than one host could send at the same time, and is uses CSMA/CD (Carrier Sense with Multiple Access using Collision Detection). A host needs to listen to the medium to see if it is free before sending, but that doesn't guarantee that there will be no collision because it takes a finite amount of time for a signal to cross the medium. The ethernet hosts will detect a collision and send a jamming signal, back off a random amount of time, and try to resend. (Switched ethernet has eliminated collisions for all practical purposes.)

Wi-Fi also uses a shared medium, so it is subject to collisions, and it uses CSMA/CA (Carrier Sense with Multiple Access using Collision Avoidance), but that doesn't mean that it can entirely avoid collisions.