网络协议是如何实现的? [英] How are network protocols implemented?

查看:104
本文介绍了网络协议是如何实现的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道协议是一组管理网络上两台计算机之间通信的规则,但是这些规则是如何为计算机实现的?协议基本上是一段代码还是软件?

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?

推荐答案

协议通常是建立在彼此之上的.冒着听起来迂腐的风险,这里有一个协议示例以及它在何处/如何实施:

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:

  • 应用程序协议 - 特定应用程序与自身或相应服务器的另一个实例通信的方式;这是在应用程序代码或共享库中实现的
  • TCP(或 UDP,或其他层) - 在二进制级别发送信息并分成可用块,然后在目的地重新组装的方式;这通常作为操作系统的一部分来实现,但它仍然是软件代码
  • IP - 信息(已经被 TCP 或 UDP 之类的东西分割或截断)通过一个或多个跳跃"路由从一个地方到另一个地方的方式;这始终是软件代码,但有时在操作系统中实现,有时在网络设备(例如您的 LAN 卡)中实现
  • base-T(以太网)、令牌环等 - 在这里,我们从物理上了解硬件如何相互通信;即,哪条线对应于特定类型的信号;这总是在硬件中实现
  • /photons - 控制(或至少定义)电子(或光子)如何在导电材料或空气中流动的定律;这通常在硬件中实现;)
  • 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!

编辑感谢 dmckee 指出电力并不是网络中使用的唯一物理过程;)

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

这篇关于网络协议是如何实现的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆