Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How are network protocols implemented?

I know that a protocol is a set of rules that governs communication between two computers on a network, but how are thoses rules implemented for the computer? Is a protocol basically a piece of code or, in other words, software?

like image 705
Robert Tracy Avatar asked Oct 24 '25 18:10

Robert Tracy


2 Answers

Protocols are generally built upon each other. At the risk of sounding pedantic, here's an example of a protocol and where/how it's implemented:

  • Application Protocol - the way a particular application talks to another instance of itself or a corresponding server; this is implemented in the application code or a shared library
  • TCP (or UDP, or another layer) - the way that information is sent at the binary level and split up into usable chunks, then reassembled at the destination; this is usually implemented as part of the operating system, but it is still software code
  • IP - the way that information (having already been split or truncated by something like TCP or UDP) makes its way from one place to another by routing over one or more "hops"; this is always software code, but is sometimes implemented in the OS and sometimes implemented in the network device (your LAN card, for example)
  • base-T (ethernet), token ring, etc - Here we are physically getting into how the hardware talks to one another; ie, which wire corresponds to a particular type of signal; this is always implemented in hardware
  • electricity /photons - the laws that govern (or at least define) how electrons (or photons) flow over a conductive material or over the air; this is usually implemented in hardware ;)

In a sense, these are all "protocols" (a set of rules or expected behaviors that allow communication to take place), and they're built on one another.

Bear in mind that (aside from electricity) this is not an exhaustive list of the sort of protocols that exist at any of these layers!

Edit Thanks to dmckee for pointing out that electricity isn't the only physical process used in networking ;)

like image 105
Adam Robinson Avatar answered Oct 28 '25 03:10

Adam Robinson


Networking protocols are not pieces of code or software, they are only a set of rules. When software uses a specific networking protocol, then the software is known as an implementation. There can be many different software implementations of the same protocol (i.e. Windows and UNIX have different TCP/IP implementations). It is possible to understand networking protocols without any knowledge of programming.


EDIT: How are they implemented? Here's a paper on taking an abstract specification of a protocol and implementing it into C. You'll see that less-strict protocols leave out certain details that programmers have to guess on, which makes some implementations incompatible with others.

like image 44
pokstad Avatar answered Oct 28 '25 04:10

pokstad