在使用Appium
的过程中,查阅不同的文档时经常会接触到wire protocol
这个词,例如Appium
服务端跟被测设备之间使用的是JSON wire protocol
交互,直译是有线协议/线路协议
,那么应该如何理解这个词呢?
维基百科的解释
In computer networking, a wire protocol refers to a way of getting data from point to point: A wire protocol is needed if more than one application has to interoperate. It generally refers to communication protocols higher than the physical layer.[1] In contrast to transport protocols at the transport level (like TCP or UDP), the term wire protocol is used to describe a common way to exchange information at the application level. It refers to an application layer protocol and defines all the required attributes for the data exchange, like data types (units of data, message formats, etc.), communication endpoints[2] and capabilities (such as delivery guarantees, direction of communication, etc.). Usually, the data is represented at the application level as a common infoset (e.g. XML, JSON, YAML) and requires a mechanism of data binding (using e.g. a common encoding scheme like XSD).
The wire protocol may be either text-based or a binary protocol. Although an important architectural decision, this is a separate matter from the distinction between wire protocols and programmatic APIs.
简单的翻译
在计算机网络,
线路协议
指的是获取点到点数据的方式:如果多于一个应用需要交互就需要线路协议
,通常指的是物理层之上更高层的通信协议,与传输层的传输协议(例如TCP
或UDP
)不同,它描述的是应用层交换信息的一种通用方式,因此它是一种应用层协议,并定义了所有数据交换要求的属性例如数据类型(数据单位、消息格式等)、通信端点、支持的能力(例如消息传递语义,通信方向等)。通常,数据是以通用信息集(例如XML
、JSON
、YMAL
等)在应用层呈现,并且要求一种数据绑定机制(使用如XSD XML范式定义
的一种通用编码方案)。
线路协议
可以是基于文本,也可以是基于二进制协议。
总结一下个人对wire protocol
的理解
1、它是一种上层(应用层)协议规范
2、它用于网络中多个应用的交互
3、它定义的是数据格式、数据交换的方式、数据交换双方可协商的能力
4、因此它不是一种具体的协议,而是一种通信双方交互方式的约定
5、因此满足这些约定,可以做到与通信应用的双方所在操作系统、所使用的编程语言无关
一些使用wire protocol
的例子
-
用于
Java
调试的Java Debug Wire Protocol
(JDWP) -
用于 Web services的SOAP
网友评论