CN102685203B - The method and apparatus of transmitting data resources - Google Patents
The method and apparatus of transmitting data resources Download PDFInfo
- Publication number
- CN102685203B CN102685203B CN201210054892.4A CN201210054892A CN102685203B CN 102685203 B CN102685203 B CN 102685203B CN 201210054892 A CN201210054892 A CN 201210054892A CN 102685203 B CN102685203 B CN 102685203B
- Authority
- CN
- China
- Prior art keywords
- capacity
- fragmentation
- option
- server
- resource
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1074—Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
- H04L67/1078—Resource delivery mechanisms
- H04L67/108—Resource delivery mechanisms characterised by resources being split in blocks or fragments
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/0231—Traffic management, e.g. flow control or congestion control based on communication conditions
- H04W28/0236—Traffic management, e.g. flow control or congestion control based on communication conditions radio quality, e.g. interference, losses or delay
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1074—Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
- H04L67/1078—Resource delivery mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/30—Definitions, standards or architectural aspects of layered protocol stacks
- H04L69/32—Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
- H04L69/322—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
- H04L69/329—Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the application layer [OSI layer 7]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/142—Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/143—Termination or inactivation of sessions, e.g. event-controlled end of session
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/565—Conversion or adaptation of application format or content
- H04L67/5651—Reducing the amount or size of exchanged application data
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/16—Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/10—Flow control between communication endpoints
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W80/00—Wireless network protocols or protocol adaptations to wireless operation
- H04W80/08—Upper layer protocols
- H04W80/12—Application layer protocols, e.g. WAP [Wireless Application Protocol]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
本发明实施例提供了一种物联网系统中数据资源传输的方法和设备。在物联网系统中基于轻量级应用层协议通过分片传输节点的数据资源的方法包括:获取节点的数据资源容量信息,资源容量信息为待传输数据容量大小;向节点发送携带第一分片选项的请求消息,其中第一分片选项包括推荐的分片容量;接收节点携带第二分片选项的响应消息,其中第二分片选项包括确定的分片容量;根据确定的分片容量以及节点的数据资源容量信息,分片传输节点的数据资源。根据本发明实施例,可以获知需要传输的节点的数据资源的容量信息,并通过分片容量协商确定传输数据时使用的分片容量,由此可以实现传输过程中错误率降低,并且可以并发地传输数据。
Embodiments of the present invention provide a method and device for data resource transmission in an Internet of Things system. In the Internet of Things system, the method for transmitting data resources of a node through fragmentation based on a lightweight application layer protocol includes: obtaining the data resource capacity information of the node, where the resource capacity information is the size of the data capacity to be transmitted; option request message, wherein the first fragmentation option includes a recommended fragmentation capacity; the receiving node carries a response message of the second fragmentation option, wherein the second fragmentation option includes a determined fragmentation capacity; according to the determined fragmentation capacity and The data resource capacity information of the node, and the data resource of the node is transmitted in fragments. According to the embodiment of the present invention, the capacity information of the data resource of the node to be transmitted can be obtained, and the fragment capacity used for data transmission can be determined through fragment capacity negotiation, thereby reducing the error rate during the transmission process, and concurrently transfer data.
Description
技术领域technical field
本发明实施例涉及网络通信领域,并且更具体地涉及数据资源传输的方法和设备。The embodiments of the present invention relate to the field of network communication, and more specifically, to a method and device for data resource transmission.
背景技术Background technique
轻量级应用层协议(Constrained Application Protocol,简称“CoAP”)主要是用于物联网(Machine to Machine,简称“M2M”)的场景中,比如:家庭控制器、楼宇自动化、智能能源、传感器网络等。在这样的环境中,这些机器的功能比较简单,一般处理器只有8位,存储空间小,不支持复杂的传输协议,数据传输速率也较低。CoAP提供一种请求/响应的交互模式,支持内嵌的资源发现,包括关键的网页概念,比如统一资源标识(URI)和内容类型。CoAP可以很容易地翻译到超文本链接协议(HTTP),用于集成到网络中。基于CoAP传输数据的传统方案中不计算数据资源的准确容量,无法评估分包的精确数目,因此无法并发获取数据资源,造成传输效率低下。The lightweight application layer protocol (Constrained Application Protocol, referred to as "CoAP") is mainly used in IoT (Machine to Machine, referred to as "M2M") scenarios, such as: home controllers, building automation, smart energy, sensor networks Wait. In such an environment, the functions of these machines are relatively simple. Generally, the processor has only 8 bits, the storage space is small, it does not support complex transmission protocols, and the data transmission rate is also low. CoAP provides a request/response interaction model that supports embedded resource discovery, including key web page concepts such as Uniform Resource Identifiers (URIs) and content types. CoAP can be easily translated to Hypertext Link Protocol (HTTP) for integration into networks. The traditional solution for data transmission based on CoAP does not calculate the exact capacity of data resources, and cannot evaluate the exact number of subcontracts. Therefore, data resources cannot be obtained concurrently, resulting in low transmission efficiency.
发明内容Contents of the invention
本发明实施例提供了一种数据资源传输的方法和设备,能够支持在CoAP中提高传输效率。Embodiments of the present invention provide a data resource transmission method and device, which can support the improvement of transmission efficiency in CoAP.
在本发明的实施例中,提出了一种在物联网系统中基于轻量级应用层协议提高传输效率的方法,可以通过分片来传输节点的数据资源,包括:获取节点的数据资源容量信息,资源容量信息为待传输数据容量大小;向节点发送携带第一分片选项的请求消息,其中第一分片选项包括推荐的分片容量;接收节点携带第二分片选项的响应消息,其中第二分片选项包括确定的分片容量,确定的分片容量小于或等于推荐的分片容量;根据确定的分片容量以及节点的数据资源容量信息,分片传输节点的数据资源。In the embodiment of the present invention, a method for improving transmission efficiency based on a lightweight application layer protocol in the Internet of Things system is proposed, and the data resources of the nodes can be transmitted through fragmentation, including: obtaining the data resource capacity information of the nodes , the resource capacity information is the size of the data capacity to be transmitted; send a request message carrying the first fragmentation option to the node, where the first fragmentation option includes the recommended fragmentation capacity; receive a response message from the node carrying the second fragmentation option, where The second fragmentation option includes a determined fragmentation capacity, and the determined fragmentation capacity is less than or equal to the recommended fragmentation capacity; according to the determined fragmentation capacity and the data resource capacity information of the node, the data resource of the transmission node is fragmented.
在本发明实施例中,提供了一种在物联网系统中基于轻量级应用层协议通过分片传输节点的数据资源的方法,接收携带第一分片选项的请求消息,其中第一分片选项包括推荐的分片容量;发送携带第二分片选项的响应消息,其中第二分片选项包括确定的分片容量,确定的分片容量小于等于推荐的分片容量;根据确定的分片容量,传输节点的数据资源。In an embodiment of the present invention, a method for transmitting data resources of a node through fragmentation based on a lightweight application layer protocol in an Internet of Things system is provided, and a request message carrying a first fragmentation option is received, wherein the first fragmentation The options include the recommended fragmentation capacity; send a response message carrying the second fragmentation option, where the second fragmentation option includes the determined fragmentation capacity, and the determined fragmentation capacity is less than or equal to the recommended fragmentation capacity; according to the determined fragmentation Capacity, the data resource of the transmission node.
在本发明实施例中,提供了一种在物联网系统中基于轻量级应用层协议通过分片传输节点的数据资源的客户端设备,客户端设备包括:获取单元,用于获取节点的数据资源容量信息;发送单元,用于发送携带第一分片选项的请求消息,其中第一分片选项包括推荐的分片容量,接收单元,接收携带第二分片选项的响应消息,其中第二分片选项包括确定的分片容量,确定的分片容量小于等于推荐的分片容量;传输单元,用于根据确定的分片容量以及节点的数据资源容量信息,分片传输节点的数据资源。In an embodiment of the present invention, a client device for transmitting data resources of a node through fragmentation based on a lightweight application layer protocol in an Internet of Things system is provided. The client device includes: an acquisition unit for acquiring data of a node Resource capacity information; a sending unit, configured to send a request message carrying a first fragmentation option, wherein the first fragmentation option includes a recommended fragmentation capacity, and a receiving unit, receiving a response message carrying a second fragmentation option, wherein the second Fragmentation options include determined fragmentation capacity, the determined fragmentation capacity is less than or equal to the recommended fragmentation capacity; the transmission unit is used to transmit the data resource of the node in fragments according to the determined fragmentation capacity and the data resource capacity information of the node.
在本发明实施例中,提供了一种在物联网系统中基于轻量级应用层协议通过分片传输节点的数据资源的服务器设备,服务器设备包括:接收单元,用于接收携带第一分片选项的请求消息,其中第一分片选项包括推荐的分片容量,发送单元,用于发送携带第二分片选项的响应消息,其中第二分片选项包括确定的分片容量,确定的分片容量小于等于推荐的分片容量;传输单元,用于根据确定的分片容量,传输节点的数据资源。In an embodiment of the present invention, a server device for transmitting data resources of a node through fragmentation based on a lightweight application layer protocol in an Internet of Things system is provided. The server device includes: a receiving unit, configured to receive option request message, wherein the first fragmentation option includes a recommended fragmentation capacity, and the sending unit is configured to send a response message carrying a second fragmentation option, wherein the second fragmentation option includes a determined fragmentation capacity, and a determined fragmentation The slice capacity is less than or equal to the recommended slice capacity; the transmission unit is used to transmit the data resource of the node according to the determined slice capacity.
根据本发明实施例,可以获知需要传输的节点的数据资源的容量信息,并通过分片容量协商确定传输数据时使用的分片容量,由此可以实现传输过程中错误率降低,并且可以并发地传输数据。According to the embodiment of the present invention, the capacity information of the data resource of the node to be transmitted can be known, and the fragment capacity used for data transmission can be determined through fragment capacity negotiation, thereby reducing the error rate during the transmission process, and concurrently transfer data.
附图说明Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。在附图中:In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without paying creative labor. In the attached picture:
图1是本发明一种实施例的传输数据的方法的流程图;FIG. 1 is a flowchart of a method for transmitting data according to an embodiment of the present invention;
图2是本发明一种实施例的网关从传感器获取数据资源的具体实现过程的流程图;Fig. 2 is a flow chart of a specific implementation process of a gateway acquiring data resources from a sensor in an embodiment of the present invention;
图3是本发明一种实施例中改进的分片选项的结构图;Fig. 3 is a structural diagram of an improved fragmentation option in an embodiment of the present invention;
图4是本发明一种替代实施例的网关从传感器获取数据资源具体实现过程的流程图;FIG. 4 is a flow chart of a specific implementation process of a gateway obtaining data resources from a sensor in an alternative embodiment of the present invention;
图5是本发明一种替代实施例中改进的分片选项的结构图;Fig. 5 is a structural diagram of an improved fragmentation option in an alternative embodiment of the present invention;
图6是本发明一种替代实施例的网关从传感器获取数据资源的具体实现过程的流程图;FIG. 6 is a flow chart of a specific implementation process for a gateway in an alternative embodiment of the present invention to obtain data resources from sensors;
图7是本发明一种替代实施例中改进的分片选项的结构图;Figure 7 is a structural diagram of an improved fragmentation option in an alternative embodiment of the present invention;
图8是本发明一种实施例的网关向传感器发送数据资源的具体实现过程的流程图;Fig. 8 is a flow chart of a specific implementation process of a gateway sending data resources to a sensor according to an embodiment of the present invention;
图9是本发明一种实施例的客户端设备的框图;Figure 9 is a block diagram of a client device according to an embodiment of the present invention;
图10是本发明一种实施例的服务器设备的框图;Fig. 10 is a block diagram of a server device according to an embodiment of the present invention;
图11是本发明一种实施例的传输数据的方法的流程图;FIG. 11 is a flowchart of a method for transmitting data according to an embodiment of the present invention;
图12是本发明一种实施例的传输数据的客户端设备的结构图;Fig. 12 is a structural diagram of a client device for transmitting data according to an embodiment of the present invention;
图13是本发明一种实施例的传输数据的服务器设备的结构图。Fig. 13 is a structural diagram of a server device for transmitting data according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
CoAP是基于用户数据报协议(User Datagram Protocol,简称“UDP”)进行传输,是基于无连接的消息处理模式。其交互模式可以是同步的响应,也可以是异步的响应。消息类型可以是:需要确认的消息(Confirmable)、不需要确认的消息(Non-confirmable)、确认消息(Acknowledgement)、重置消息(Reset)。可以通过消息标识(Message ID)来关联一对请求和响应。CoAP is based on User Datagram Protocol (User Datagram Protocol, referred to as "UDP") for transmission, and is based on a connectionless message processing mode. Its interaction mode can be a synchronous response or an asynchronous response. The message type may be: a message requiring confirmation (Confirmable), a message not requiring confirmation (Non-confirmable), an confirmation message (Acknowledgment), and a reset message (Reset). A pair of request and response can be associated by a message ID (Message ID).
CoAP支持的方法有四个:获取资源(Get)、更新资源(Put)、创建资源(Post)和删除资源(Delete)。资源通过表述性状态转移(RepresentationalState Transfer,简称“REST”)URI来识别。我们通常称资源的拥有方为节点或服务器,包括但不限于传感器、控制器、端点(End-point)等,请求资源方为客户端,包括但不限于网关(Proxy)、网络侧设备。There are four methods supported by CoAP: obtaining resources (Get), updating resources (Put), creating resources (Post) and deleting resources (Delete). A resource is identified by a Representational State Transfer ("REST") URI. We usually refer to the resource owner as a node or server, including but not limited to sensors, controllers, endpoints (End-point), etc., and the resource requesting party as a client, including but not limited to gateways (Proxy), network side devices.
CoAP协议支持不同的选项(Option),用以解释CoAP消息体中数据的语义,比如Block(分片)、Location(位置)、Token(令牌)选项等,不同的选项支持不同的功能,并且可以通过定义新的Option来扩展新的功能。The CoAP protocol supports different options (Option) to explain the semantics of the data in the CoAP message body, such as Block (fragmentation), Location (position), Token (token) options, etc. Different options support different functions, and New functions can be extended by defining new Option.
CoAP支持分片选项(Block Option),主要用于将较大的资源进行分片传输,以适应于低带宽传输的应用场景。Block选项可以为1个字节、2个字节或3个字节,依据分片数目的容量所需要的长度进行选取。CoAP supports the block option (Block Option), which is mainly used to transmit larger resources in pieces to adapt to the application scenario of low-bandwidth transmission. The Block option can be 1 byte, 2 bytes or 3 bytes, which is selected according to the length required by the capacity of the number of fragments.
传统方案中不计算数据资源的准确容量,无法评估分包的精确数目,因此无法并发获取。另外也不知道资源是静态的还是动态的。In the traditional solution, the exact capacity of data resources is not calculated, and the exact number of subcontracts cannot be evaluated, so concurrent acquisition is impossible. In addition, it is not known whether the resource is static or dynamic.
在以下描述中,通常称资源的拥有方为服务器,以传感器作为示例,请求资源方为客户端,以网关作为示例。但是,传感器或者网关并不用作对服务器或者客户端的限制。In the following description, the resource owner is usually referred to as the server, and the sensor is taken as an example, and the resource requesting party is called the client, and the gateway is taken as an example. However, sensors or gateways are not used as constraints to servers or clients.
由于不知道目标资源的精确容量,网关在<Get>命令中使用Block Option时,只能按顺序来获取,即选获取Block 0,等Block 0返回时,再获取Block1,一直到最后一个Block。不能并发地发送<Get>请求。Since the precise capacity of the target resource is not known, when the gateway uses the Block Option in the <Get> command, it can only obtain in order, that is, select to obtain Block 0, and when Block 0 returns, then obtain Block1 until the last Block. Cannot send <Get> requests concurrently.
Block选项的字段结构一般包括NUM字段,M字段和SZX字段,其中The field structure of the Block option generally includes the NUM field, the M field and the SZX field, where
NUM表示分片的顺序序号,可以是4~20位的无符号整型数字。0表示第一个分片。NUM represents the serial number of the slice, which can be an unsigned integer number of 4 to 20 bits. 0 means the first shard.
M:用一个比特位来表示当前分片后面是否还有其他分片,其值为1表示后面还有分片,为0表示后面没有分片,即为最后一个分片。M: A bit is used to indicate whether there are other fragments behind the current fragment. Its value is 1, which means there are fragments behind, and 0, which means there are no fragments behind, which is the last fragment.
SZX:用于表征分片容量,其计算公式为:分片容量=2^(SZX+4),即2的(SZX+4)次方。由于SZX由3个比特位来表示,其值可以为0~7,所以分片容量的取值范围:2^4~2^11,即16~2048。SZX: It is used to represent the fragmentation capacity, and its calculation formula is: fragmentation capacity=2^(SZX+4), that is, 2 to the power of (SZX+4). Since SZX is represented by 3 bits, its value can be 0~7, so the value range of the slice capacity is: 2^4~2^11, that is, 16~2048.
对于Block选项的使用说明如下:The instructions for using the Block option are as follows:
在<Get>请求中,Block选项的NUM字段给出当前请求的分片的序号,并且当分片序号为0时,SZX给出网关建议的每个分片的容量。在<Get>响应中或是<Put>/<Post>请求中,Block选项的NUM字段描述当前传输的分片的序号,M字段表明后面是否还有后续分片。In the <Get> request, the NUM field of the Block option gives the serial number of the currently requested fragment, and when the fragment serial number is 0, SZX gives the capacity of each fragment suggested by the gateway. In the <Get> response or <Put>/<Post> request, the NUM field of the Block option describes the sequence number of the currently transmitted fragment, and the M field indicates whether there are subsequent fragments.
在<Put>/<Post>响应中,Block选项的NUM字段表明当前响应的分片序号。In the <Put>/<Post> response, the NUM field of the Block option indicates the fragment sequence number of the current response.
当网关使用<Get>方法获取第一个分片(Block)时,NUM被设置为0,并携带建议的分片容量(即SZX),传感器节点可以选择同意建议的分片容量,或是选择一个比建议分片小的分片,并在响应中返回,同时,在响应中返回第一个分片的数据。When the gateway uses the <Get> method to obtain the first block (Block), NUM is set to 0 and carries the suggested block capacity (ie SZX), the sensor node can choose to agree to the proposed block capacity, or choose A shard smaller than the suggested shard is returned in the response, along with the first shard's data in the response.
本发明考虑网关事先获知目标资源的精确容量,则网关可以选择是否用BlockOption来发送资源获取的请求,也可以实现并发请求,即在请求Block0的同时,也可以请求Block 1,而不必等待。在请求Block的顺序上也可以灵活处理。The present invention considers that the gateway knows the precise capacity of the target resource in advance, so the gateway can choose whether to use BlockOption to send a request for resource acquisition, and can also implement concurrent requests, that is, while requesting Block0, it can also request Block 1 without waiting. The order of requesting blocks can also be handled flexibly.
简单设计方案中,Block Option有三个选择,可以是一个字节,可以是2个字节,也可以是三个字节,依据资源的容量不同,分片(Block)的数量容量不同,所需要的长度也不一样。协议规定,除了最后一个分片外,分片的容量必须相同,但每次传输中,还是每次都需要携带M位(表明后面是否还有分片)和SZX(分片的容量)。In the simple design scheme, there are three options for Block Option, which can be one byte, two bytes, or three bytes. Depending on the capacity of resources, the number and capacity of blocks (Blocks) are different, and the required The length is also different. The agreement stipulates that except for the last fragment, the capacity of the fragments must be the same, but each transmission still needs to carry the M bit (indicating whether there are fragments behind) and SZX (the capacity of the fragment).
每次在请求和响应中,M位和SZX位都需要传送,而实际上,除了最后一个分片外,M位和SZX的值每次都是相同的,重复的传输浪费传输资源。重复发送SZX的目的假定双方都不保存协商后的SZX,第一次响应中携带的是协商后的SZX,网关从响应中获取并再次在请求中发送,从而网关和传感器都不需要保存状态。在一次的请求响应回合中,共浪费一个字节,如果分片数目很多时,浪费的字节就很多了,对于M2M设备,传输资源是受限的,这个传输资源的浪费是很可观的。假设要传送的数据为64M的话,每个Block的负载(payload)容量为1024byte则发送的block条目数为:65536。则发送的Block选项按照字节来分的个数为:Every time in the request and response, the M bit and the SZX bit need to be transmitted, but in fact, except for the last fragment, the values of the M bit and SZX are the same every time, and repeated transmission wastes transmission resources. The purpose of repeatedly sending SZX assumes that neither party saves the negotiated SZX, the first response carries the negotiated SZX, the gateway obtains it from the response and sends it again in the request, so neither the gateway nor the sensor needs to save the state. In one request-response round, a total of one byte is wasted. If there are many fragments, a lot of bytes are wasted. For M2M devices, transmission resources are limited, and this waste of transmission resources is considerable. Assuming that the data to be transmitted is 64M, and the payload capacity of each block is 1024byte, the number of block entries sent is: 65536. Then the number of the sent Block options divided by bytes is:
(1)一个字节:16个(1) One byte: 16
(2)两个字节:4080个(2) Two bytes: 4080
(3)三个字节:61440个(3) Three bytes: 61440
如果M和SZX可以不发送,则请求加上响应能够节省的数据为65536字节(byte),即64K数据。另外,如果这两个字段不要,则NUM字段可以用满所有位(bit),则需要发送的数据包的数目变更为:If M and SZX can not be sent, the data that can be saved by the request plus the response is 65536 bytes (byte), that is, 64K data. In addition, if these two fields are not required, the NUM field can use up all bits (bits), and the number of data packets that need to be sent is changed to:
(1)一个字节:256个(1) One byte: 256
(2)两个字节:65280个(2) Two bytes: 65280
此时不需要发送3个字节的结构,因此还可以节省数据为61440*2bytes,即60K数据。则总共节省数据位124K,节省数据率0.189%。头域节省百分比为(16+4080*2+61440*3-256-65280*2)/(16+4080*2+61440*3)=61680/192496=32%。At this time, there is no need to send the structure of 3 bytes, so the data can be saved as 61440*2bytes, that is, 60K data. Then a total of 124K data bits are saved, and the data rate is saved by 0.189%. The saving percentage of the header field is (16+4080*2+61440*3-256-65280*2)/(16+4080*2+61440*3)=61680/192496=32%.
节省数据量的公式:Formula to save data volume:
T为总的Block数量,S为分片容量(Block Size),节省的流量的百分比(只比较头域):T is the total number of blocks, S is the fragmentation capacity (Block Size), and the percentage of saved traffic (only the header field is compared):
T<16时:无节省;两者都是一个字节;When T<16: no savings; both are one byte;
16<T<256时:1-T*1/(16*1+(T-16)*2),简单设计方案需要2个字节,优选方案只需要一个字节;When 16<T<256: 1-T*1/(16*1+(T-16)*2), the simple design requires 2 bytes, and the optimal design requires only one byte;
256<T<4096时:1-(256*1+(T-256)*2))/(16*1+(T-16)*2),简单设计方案需要2个字节,优选方案需要2个字节;256<T<4096: 1-(256*1+(T-256)*2))/(16*1+(T-16)*2), the simple design requires 2 bytes, and the optimal design requires 2 bytes;
4096<T<65256时:1-(256*1+(4096-256)*2+(T-4096)*3))/(256*1+(T-256)*2),简单设计方案需要3个字节,优选方案需要2个字节。When 4096<T<65256: 1-(256*1+(4096-256)*2+(T-4096)*3))/(256*1+(T-256)*2), simple design requires 3 bytes, the preferred solution requires 2 bytes.
T>65256时,无节省,本发明优选方案实施例和简单设计方案都需要3个字节。When T>65256, there is no saving, and both the preferred embodiment of the present invention and the simple design require 3 bytes.
简单设计方案中,使用Put/Post命令时,分片容量协商缺乏效率。在Put/Post请求中,对于第一个分片,需要发送第一个分片的数据和推荐的分片容量,如果传感器节点选择不一样的分片容量,网关需要按照传感器的分片容量进行重新发送,则上次发送的分片数据被浪费掉了。而且,网关在使用Put/Post请求基于分片选项发送容量大的资源时,事先无法告知传感器资源容量信息,在传输过程中,传感器边接收,边缓存所接收的资源,如果传感器发现存储空间不够,而资源又未传输完成时,只能发送回一个413的错误状态码,表示请求的资源太大,结束此次传输。此前传输的部分资源则没用了,传输资源被浪费了。如果网关能够在第一个分片消息中告知传感器所要传输的资源的容量信息,传感器则可以比较资源容量信息与存储容量,如果容量不足,提前返回413“请求的资源太大”的状态码,来结束资源传输,以此来达到节省传输资源的目的。In the simple design scheme, when using the Put/Post command, the fragmentation capacity negotiation is inefficient. In the Put/Post request, for the first shard, the data of the first shard and the recommended shard capacity need to be sent. If the sensor node chooses a different shard capacity, the gateway needs to follow the shard capacity of the sensor. If it is resent, the fragment data sent last time will be wasted. Moreover, when the gateway uses the Put/Post request to send large-capacity resources based on the fragmentation option, it cannot inform the sensor of resource capacity information in advance. During the transmission process, the sensor receives and caches the received resources. If the sensor finds that the storage space is not enough , and the resource has not been transferred, only a 413 error status code can be sent back, indicating that the requested resource is too large, and the transfer ends. Part of the previously transmitted resources are useless, and the transmission resources are wasted. If the gateway can inform the sensor of the capacity information of the resource to be transmitted in the first fragment message, the sensor can compare the resource capacity information with the storage capacity, and if the capacity is insufficient, return the status code 413 "The requested resource is too large" in advance. To end the resource transmission, so as to achieve the purpose of saving transmission resources.
互联网上的断点续传,也就是要从文件已经下载的地方开始继续下载。网关在向传感器请求数据的时候,要多加一条信息来表示请求下载数据的范围(Range),表明从哪里开始。To continue uploading from a breakpoint on the Internet, that is to continue downloading from the place where the file has already been downloaded. When the gateway requests data from the sensor, it needs to add an additional piece of information to indicate the range of the requested data download (Range), indicating where to start.
比如,网关用浏览器来传递请求信息给Web传感器,要求从2000070字节开始:For example, the gateway uses the browser to pass the request information to the web sensor, which requires starting from 2000070 bytes:
GET/down.zip HTTP/1.0GET/down.zip HTTP/1.0
User-Agent:NetFoxUser-Agent: NetFox
Range:bytes=2000070-Range: bytes=2000070-
Accept:text/html,image/gif,image/jpeg,*;q=.2,*/*;q=.2Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
其中,RANGE:bytes=2000070-,这一行的意思就是告诉传感器down.zip这个文件从2000070字节开始传,前面的字节不用传了。Among them, RANGE: bytes=2000070-, the meaning of this line is to tell the sensor down.zip that the file starts to be transmitted from 2000070 bytes, and the previous bytes do not need to be transmitted.
这种方案的缺点是,没有分片机制,不支持分片容量的协商,也不支持分片总数的协商。本发明实施例考虑了在分片传输过程中,进行分片容量和/或分片总数的协商。为此本发明提供了一种数据分片传输的方法,可以获取目标数据资源的精确容量,进行分片容量的协商,获取分片总数,并根据分片总数进行数据资源传输。The disadvantage of this solution is that there is no fragmentation mechanism, and neither does it support the negotiation of the fragmentation capacity nor the negotiation of the total number of fragments. The embodiment of the present invention considers negotiating the fragment capacity and/or the total number of fragments during the fragment transmission process. Therefore, the present invention provides a method for data slice transmission, which can obtain the precise capacity of the target data resource, negotiate the slice capacity, obtain the total number of slices, and perform data resource transmission according to the total number of slices.
以下参照图1具体说明本发明一种实施例的流程。图1是本发明一种实施例的流程图。The flow of an embodiment of the present invention will be specifically described below with reference to FIG. 1 . Fig. 1 is a flowchart of an embodiment of the present invention.
在S110过程中,获取节点的数据资源的容量信息。如果是网关从传感器获取数据,则节点的数据资源容量信息保存在传感器上。网关可以通过请求消息,向传感器获取节点的数据资源的容量信息。如果是网关向传感器发送数据,则网关本地已经知道了节点的数据资源的容量信息。获取节点的数据资源容量信息,是为下一步进行分片容量的协商并确定分片总数做准备。In the process of S110, the capacity information of the data resource of the node is acquired. If the gateway acquires data from the sensor, the node's data resource capacity information is stored on the sensor. The gateway can obtain the capacity information of the data resource of the node from the sensor through the request message. If the gateway sends data to the sensor, the gateway already knows the capacity information of the node's data resources locally. Obtaining the data resource capacity information of the node is to prepare for the next step of negotiating the fragmentation capacity and determining the total number of fragments.
接着,在S120的过程中,网关向传感器发送携带第一分片选项的请求消息,其中所述第一分片选项包括推荐的分片容量。传感器在收到S120中发送的请求消息之后,根据自身能力,确定本次数据资源传输过程中所使用的分片容量,并且传感器确定的分片容量小于等于网关推荐的分片容量。Next, in the process of S120, the gateway sends a request message carrying a first fragmentation option to the sensor, where the first fragmentation option includes a recommended fragmentation capacity. After receiving the request message sent in S120, the sensor determines the fragmentation capacity used in this data resource transmission process according to its own capability, and the fragmentation capacity determined by the sensor is less than or equal to the fragmentation capacity recommended by the gateway.
在S130,网关接收携带第二分片选项的响应消息,其中所述第二分片选项包括确定的分片容量,所述确定的分片容量小于等于所述推荐的分片容量。网关在接到确定的分片容量之后,根据掌握的节点的数据资源容量信息,确定将要传输的节点的数据资源的分片总数。At S130, the gateway receives a response message carrying a second fragmentation option, where the second fragmentation option includes a determined fragmentation capacity, and the determined fragmentation capacity is less than or equal to the recommended fragmentation capacity. After receiving the determined fragment capacity, the gateway determines the total number of fragments of the data resource of the node to be transmitted according to the information about the capacity of the node's data resource.
然后,在S140,根据所述确定的分片容量以及所述节点的数据资源容量信息,分片传输所述数据资源。Then, at S140, transmit the data resource in fragments according to the determined fragment capacity and the data resource capacity information of the node.
根据本发明实施例,可以获知需要传输的数据资源的容量信息,并通过分片容量协商确定传输数据时使用的分片容量,由此可以实现传输过程中错误率降低,并且可以并发地传输数据。According to the embodiment of the present invention, the capacity information of the data resources to be transmitted can be known, and the fragment capacity used for data transmission can be determined through fragment capacity negotiation, thereby reducing the error rate during the transmission process and concurrently transmitting data .
以下结合图2说明如图1所示实施例的具体实现过程。图2表示的是网关从传感器获取数据的说明性示例,仅为说明本发明的构思,而不作为对本发明的限制。The specific implementation process of the embodiment shown in FIG. 1 will be described below with reference to FIG. 2 . Fig. 2 shows an illustrative example in which a gateway acquires data from a sensor, which is only for illustrating the concept of the present invention, but not as a limitation to the present invention.
图2所示数据资源获取过程具体描述如下:The specific description of the data resource acquisition process shown in Figure 2 is as follows:
ES210:网关向传感器发送资源发现请求,即通过Get./wellknown/core来获取传感器上的资源列表。ES210: The gateway sends a resource discovery request to the sensor, that is, obtains the resource list on the sensor through Get./wellknown/core.
ES220:传感器向网关返回资源列表,以及资源指示信息;资源指示信息主要包括资源的寻址信息(即URI)、资源名称、资源描述信息、内容类型等。本发明对资源指示信息进行扩展,扩展的资源指示信息包括:资源是动态资源还是静态资源的指示信息。ES220: The sensor returns a resource list and resource indication information to the gateway; the resource indication information mainly includes resource addressing information (ie URI), resource name, resource description information, content type, etc. The present invention expands the resource indication information, and the extended resource indication information includes: indication information of whether the resource is a dynamic resource or a static resource.
ES230:网关根据传感器返回的资源列表,根据资源的指示信息,从中选择目标资源,并根据识别标识(能唯一识别资源的信息,比如资源名称、URI等),获取目标资源。ES230: The gateway selects the target resource according to the resource list returned by the sensor, according to the indication information of the resource, and obtains the target resource according to the identification (information that can uniquely identify the resource, such as resource name, URI, etc.).
ES240:传感器对目标资源容量进行判断,如果资源容量小于一个传输层消息包的容量,则直接返回资源内容给网关;如果资源容量超过一个传输层消息包的容量,则返回资源容量信息。可选地,传感器可使用分片选项,根据自身确定的分片容量,直接返回第一个分片。后续客户端和传感器根据此确定的分片容量,使用分片选项传输如下的分片。ES240: The sensor judges the capacity of the target resource. If the resource capacity is less than the capacity of a transport layer message packet, it will directly return the resource content to the gateway; if the resource capacity exceeds the capacity of a transport layer message packet, it will return the resource capacity information. Optionally, the sensor can use the sharding option to directly return the first shard according to the shard capacity determined by itself. Subsequent clients and sensors transmit the following shards using the shard option based on this determined shard capacity.
在本发明一种替代实施例中,如果目标数据资源为动态数据资源,同时返回动态数据资源指示给网关,并用413“请求资源太大”的状态码指示网关使用Block选项来获取资源。In an alternative embodiment of the present invention, if the target data resource is a dynamic data resource, an indication of the dynamic data resource is returned to the gateway at the same time, and a status code of 413 "request resource is too large" is used to instruct the gateway to use the Block option to obtain the resource.
如果数据资源为动态资源,则指示信息中的资源容量表示的是当前的资源快照(Snapshot)的容量信息,传感器需要缓存此快照数据;如果是静态资源,则指示信息中的资源容量信息是精确的容量信息。本领域技术人员应该理解,如果数据资源为动态资源,则传感器可以发送资源快照的校验码,网关如果需要更新鲜的数据,可以后续再发送新的资源获取请求。If the data resource is a dynamic resource, the resource capacity in the indication information represents the capacity information of the current resource snapshot (Snapshot), and the sensor needs to cache the snapshot data; if it is a static resource, the resource capacity information in the indication information is accurate capacity information. Those skilled in the art should understand that if the data resource is a dynamic resource, the sensor can send a verification code of the resource snapshot, and if the gateway needs fresher data, it can send a new resource acquisition request later.
ES250:网关根据数据资源容量信息,判断需要使用分片选项,并发送携带分片选项的请求消息,与传感器器进行分片容量协商,指示推荐的分片容量。ES250: The gateway judges that the fragmentation option needs to be used according to the data resource capacity information, and sends a request message carrying the fragmentation option, negotiates with the sensor on the fragmentation capacity, and indicates the recommended fragmentation capacity.
ES260:传感器根据自身能力,确定分片容量,并将其返回给网关。可选地,传感器同时返回分片总数。当然,由于网关已经获取了数据资源容量信息,分片总数也可以由网关确定。需要说明的是,传感器确定的分片容量只能小于或等于网关推荐的分片容量。ES260: The sensor determines the fragmentation capacity according to its own capabilities, and returns it to the gateway. Optionally, the sensor returns the total number of shards at the same time. Of course, since the gateway has obtained the data resource capacity information, the total number of fragments can also be determined by the gateway. It should be noted that the fragmentation capacity determined by the sensor can only be less than or equal to the fragmentation capacity recommended by the gateway.
ES270:网关从1一直到分片总数,依次向传感器发送请求,请求获取与分片序号对应的数据资源的分片数据。ES270: The gateway sequentially sends requests from 1 to the total number of fragments to the sensor, requesting to obtain the fragmented data of the data resource corresponding to the fragment sequence number.
ES280:传感器根据确定的分片容量,返回该分片序号及与该分片序号对应的数据资源的分片数据,直到完全传输完毕。ES280: According to the determined fragment capacity, the sensor returns the fragment number and the fragment data of the data resource corresponding to the fragment number until the transmission is complete.
根据本发明的一种优选实施例,ES270中可以实现并行处理,即网关可以同时请求获取多个分片消息,而不需要等待传感器返回对前一个分片请求消息的响应消息。According to a preferred embodiment of the present invention, parallel processing can be realized in ES270, that is, the gateway can simultaneously request to obtain multiple fragment messages without waiting for the sensor to return a response message to the previous fragment request message.
ES210至ES240的代码例如为:The codes for ES210 to ES240 are, for example:
REQ:GET/.well-known/core---发送请求到默认的URI,即根目录获取资源列表;REQ: GET/.well-known/core---Send a request to the default URI, which is the root directory to get the resource list;
RES:200OK --响应标识获取成功,并携带了2组资源指示信息;RES: 200OK -- The response identifier is obtained successfully, and it carries 2 sets of resource indication information;
REQ:GET/sensors/firmware-请求固件资源REQ: GET /sensors/firmware - request firmware resource
RES:413“Request Entity Too Large”Size:88000.413状态码表明请求的资源太大,其精确容量为88000字节。RES: 413 "Request Entity Too Large" Size: 88000. The 413 status code indicates that the requested resource is too large, and its precise capacity is 88000 bytes.
如果数据资源为动态资源,即数据资源在传输的过程会动态变化,例如可以采用以下两种方案实施处理:If the data resource is a dynamic resource, that is, the data resource will change dynamically during the transmission process, for example, the following two solutions can be used for processing:
(1)在开始传送数据资源时,对该资源建立快照(Snapshot),即缓存此刻该数据资源的容量信息,并传输这个容量信息,不管后续的变化;对应上述方案。(1) When starting to transmit a data resource, create a snapshot of the resource (Snapshot), that is, cache the capacity information of the data resource at the moment, and transmit the capacity information, regardless of subsequent changes; corresponding to the above scheme.
(2)如果数据资源在传输过程中被修改,传感器可以在任意一个获取数据资源的请求消息的响应消息中,返回错误码,指示数据资源已更改,网关需要重新获取。(2) If the data resource is modified during transmission, the sensor can return an error code in the response message of any request message to obtain the data resource, indicating that the data resource has been changed and the gateway needs to obtain it again.
可选地,网关和传感器在消息交互中,增加认证信息。认证信息中可包含身份标识(ID)、基于身份标识和密码(Password)算出来的密钥信息(Digest)。身份标识和密码可以是预先配置给网关和传感器双方。配置过程:Optionally, the gateway and the sensor add authentication information during message interaction. The authentication information may include an identity (ID), and key information (Digest) calculated based on the identity and a password (Password). Identity and password can be pre-configured for both the gateway and the sensor. Configuration process:
例如,密钥的算法可以为:Digest=MD5(ID:Password),即对ID和Password组成的字符串使用MD5算法进行哈希(Hash),Hash的值为Digest。发送方发送ID和Digest,接收方根据接收到ID和预先存储的Password,根据同样的算法得出Digest,与发送方发送的Digest进行比较,如果一致,则认证通过。For example, the algorithm of the key may be: Digest=MD5(ID: Password), that is, the character string composed of ID and Password is hashed (Hash) using the MD5 algorithm, and the value of Hash is Digest. The sender sends the ID and Digest, and the receiver obtains the Digest according to the same algorithm based on the received ID and the pre-stored Password, and compares it with the Digest sent by the sender. If they are consistent, the authentication is passed.
网关从传感器获取数据资源时,如图2所示,需要知道数据资源容量信息。根据本发明一种实施例,网关可以采用如下方案来获取存储于传感器的数据资源容量信息。When the gateway acquires data resources from the sensor, as shown in Figure 2, it needs to know the capacity information of the data resources. According to an embodiment of the present invention, the gateway may adopt the following solution to obtain the data resource capacity information stored in the sensor.
(1)扩展链接格式(Link-format)关键字(1) Extended link format (Link-format) keyword
在Link-format中,扩展一个关键字,-sn,或-snapshot,用于在获取数据资源请求的响应中,表明资源数据是否是快照数据。如果此参数不存在,或其值为0,表明是静态资源,如果此参数的值为1,则表明是当前数据是动态资源,获取的数据是当前的快照。静态资源是指一段时间内相对稳定的资源,即资源内容不会频繁更改。具体含义可以在标准中进行定义。在本发明中,主要指资源的值不改变的情况。In Link-format, expand a keyword, -sn, or -snapshot, which is used to indicate whether the resource data is snapshot data in the response to the request to obtain the data resource. If this parameter does not exist, or its value is 0, it indicates that it is a static resource; if the value of this parameter is 1, it indicates that the current data is a dynamic resource, and the acquired data is the current snapshot. Static resources refer to resources that are relatively stable for a period of time, that is, the content of the resource does not change frequently. The specific meaning can be defined in the standard. In the present invention, it mainly refers to the case where the value of the resource does not change.
还扩展关键字:-asz,表明资源的准确容量的信息。Also expands keywords: -asz, information indicating the exact capacity of the resource.
消息实例:Message instance:
网关向传感器发送资源发现的请求:The gateway sends a resource discovery request to the sensor:
REQ:GET/.well-known/core---发送请求到默认的URI,即根目录获取资源列表REQ: GET/.well-known/core---Send a request to the default URI, which is the root directory to get the resource list
传感器向网关发送资源的响应:Sensor sends resource response to gateway:
RES:200OK --响应标识获取成功,并携带了2组资源指示信息RES: 200OK -- The response identifier was obtained successfully, and it carried 2 sets of resource indication information
此响应消息是封装在CoAP消息的消息体中的,接收方(即网关)根据Link-format标准中的规定进行解析。The response message is encapsulated in the message body of the CoAP message, and the receiver (that is, the gateway) parses it according to the provisions in the Link-format standard.
(2)增加状态码(2) Add status code
在收到网关的数据资源获取请求时,如果资源太大,一个包传送不下,传感器用状态码来通知网关,用于表明,资源太大,需要用Block Option来请求。When receiving a data resource acquisition request from the gateway, if the resource is too large to be transmitted in one packet, the sensor notifies the gateway with a status code to indicate that the resource is too large and needs to be requested with a Block Option.
比如,可以规定状态码413,用于表明当前数据资源容量过大,指示网关在请求中用Block选项。可以根据需要规定其他的状态码,以用于表示其他含义,用于其它目的。For example, status code 413 may be specified to indicate that the current data resource capacity is too large, and to instruct the gateway to use the Block option in the request. Other status codes can be specified as required to express other meanings and for other purposes.
消息实例:Message instance:
网关向传感器发送资源获取的请求:The gateway sends a resource acquisition request to the sensor:
GET/sensordataGET /sensordata
传感器向网关发送带状态码的响应:The sensor sends a response to the gateway with a status code:
ACK 413(状态码,表明数据资源容量太大)ACK 413 (status code, indicating that the data resource capacity is too large)
(3)在CoAP的头字段(Header)中增加一个表明容量(Size)的选项(Option)(3) Add an option (Option) to indicate the capacity (Size) in the header field (Header) of CoAP
网关在请求中,可以用容量选项(Size Option)来指示传感器,让传感器返回数据资源的容量;传感器在响应中,用Size Option来指明数据资源的容量。In the request, the gateway can use the Size Option to indicate the sensor, so that the sensor can return the capacity of the data resource; in the response, the sensor can use the Size Option to indicate the capacity of the data resource.
或者是,即使网关没有Size Option的指示,传感器也在响应中用SizeOption指明资源容量,尤其是资源比较大的情况下,传感器应该指示。Or, even if the gateway does not indicate the Size Option, the sensor also uses the Size Option to indicate the resource capacity in the response, especially when the resource is relatively large, the sensor should indicate.
如果资源较小,传感器直接在消息体(Body)中返回资源数据,则网关应该以资源数据的实际容量为准,Size Option中表明的资源容量可以用于核对。If the resource is small, the sensor directly returns the resource data in the message body (Body), the gateway should refer to the actual capacity of the resource data, and the resource capacity indicated in the Size Option can be used for checking.
如果资源较大,传感器不返回资源数据,只用Size Option返回数据的容量,同时用状态码指示给网关,让网关发起新的请求,用Block Option来请求。If the resource is large, the sensor does not return the resource data, but only uses the Size Option to return the capacity of the data, and at the same time uses the status code to indicate to the gateway, so that the gateway can initiate a new request and use the Block Option to request.
Size Option的代码可以为16,数据类型为整型,数据长度为1~4个字节,数据单位为字节。Size Option主要用于<Get>方法的响应中,<Put>/<Post>方法的请求中,用于表示资源的容量;如果是在<Get>方法的请求中,其值没有实际的意义,推荐置为0。The code of Size Option can be 16, the data type is integer, the data length is 1 to 4 bytes, and the data unit is byte. Size Option is mainly used in the response of the <Get> method and the request of the <Put>/<Post> method to indicate the capacity of the resource; if it is in the request of the <Get> method, its value has no practical meaning. It is recommended to set it to 0.
消息实例:Message instance:
网关向传感器发送资源获取的请求:The gateway sends a resource acquisition request to the sensor:
GET/sensordataGET /sensordata
传感器向网关发送带状态码的响应:The sensor sends a response to the gateway with a status code:
ACK+413+Size 51200(50K字节)ACK+413+Size 51200 (50K bytes)
以下结合图3说明如图1所示实施例的具体实现过程。图3表示的是网关向传感器发送数据的说明性示例,仅为说明本发明的构思,而不作为对本发明的限制。The specific implementation process of the embodiment shown in FIG. 1 will be described below with reference to FIG. 3 . Fig. 3 shows an illustrative example of sending data from a gateway to a sensor, which is only for illustrating the concept of the present invention, but not as a limitation to the present invention.
当网关使用<Get>方法获取第一个分片(Block)数据时,NUM字段被设置为0,并携带推荐的分片容量(即SZX),传感器可以选择同意推荐的分片容量,或是选择一个小于等于推荐的分片容量的分片容量,并在响应中返回,同时,在响应中返回第一个分片的分片数据。因此,在NUM字段为0时,<Get>请求有双重语义,一是获取第一个分片数据,二是进行分片容量的协商。这样带来协议在处理上的二义性,而且无法携带数据容量等信息。When the gateway uses the <Get> method to obtain the first block (Block) data, the NUM field is set to 0 and carries the recommended block size (ie SZX), the sensor can choose to agree to the recommended block size, or Select a shard size that is less than or equal to the recommended shard size and return it in the response. At the same time, return the shard data of the first shard in the response. Therefore, when the NUM field is 0, the <Get> request has dual semantics, one is to obtain the first fragment data, and the other is to negotiate the fragment capacity. This brings ambiguity in the processing of the protocol, and information such as data capacity cannot be carried.
本发明实施例对此进行了改进,在本发明的一种实施例中,网关在<Get>方法的请求中使用Block Option时,如果NUM字段被设置为0,表示双方只进行分片容量的协商,以及分片总数的协商。即传感器在响应中,使用NUM字段返回分片总数,使用SZX字段返回传感器确定的分片容量。M字段可以去掉,节省一个Bit,用于NUM字段。因为请求方,例如网关知道分片总数,所以从分片的NUM字段就可以知道该分片是否是最后一个分片,因此就不需要再使用M字段。在这种情况下,如果请求获取第一个分片的分片数据,则将NUM设置为1,依次类推。The embodiment of the present invention improves this. In one embodiment of the present invention, when the gateway uses the Block Option in the request of the <Get> method, if the NUM field is set to 0, it means that both parties only perform fragmentation capacity Negotiation, and the negotiation of the total number of fragments. That is, in the response, the sensor uses the NUM field to return the total number of fragments, and uses the SZX field to return the fragment capacity determined by the sensor. The M field can be removed to save a bit for the NUM field. Because the requester, such as the gateway, knows the total number of fragments, it can know whether the fragment is the last fragment from the NUM field of the fragment, so there is no need to use the M field. In this case, if requesting to get shard data for the first shard, set NUM to 1, and so on.
需要说明的是,如果网关发送第一个请求时,不知道数据资源的容量,所以BlockOption可以使用一个字节,如果传感器的数据资源较大,分片数目较大,则传感器可以在响应中使用二个字节或者三个字节来返回分片总数。It should be noted that if the gateway does not know the capacity of the data resource when sending the first request, BlockOption can use one byte. If the data resource of the sensor is large and the number of fragments is large, the sensor can use it in the response Two bytes or three bytes to return the total number of fragments.
当Block Option为2个字节时,其设计成SZX字段占用第二个字节的最后三位,表示分片容量;NUM字段占用第一个字节加上第二个字节的前5位,表示当前分片序号;如果是在NUM为0的请求对应的响应消息中,则表示分片总数。本领域技术人员理解,可以用消息标识(Message ID)来关联请求与响应,即请求和响应中都携带唯一的事务标识,这样传感器就能理解此响应消息是用于返回分片总数。When the Block Option is 2 bytes, it is designed so that the SZX field occupies the last three bits of the second byte, indicating the fragment capacity; the NUM field occupies the first byte plus the first 5 bits of the second byte , indicating the current fragment sequence number; if it is in the response message corresponding to the request where NUM is 0, it indicates the total number of fragments. Those skilled in the art understand that the message ID (Message ID) can be used to associate the request and the response, that is, both the request and the response carry a unique transaction ID, so that the sensor can understand that the response message is used to return the total number of fragments.
以下举例说明分片容量协商过程,消息实例为:The following example illustrates the fragment capacity negotiation process, and the message example is:
网关向传感器发送资源获取的请求:The gateway sends a resource acquisition request to the sensor:
GET 00000 101(NUM为0,SZX为101,即5,表示分片容量为2的9次方,即512)GET 00000 101 (NUM is 0, SZX is 101, which is 5, which means that the fragment capacity is 2 to the 9th power, which is 512)
传感器向网关发送的响应:The response sent by the sensor to the gateway:
ACK 10000 100(NUM为:10000,即总分片数为32,SZX为100,即4,表示分片容量为2的8次方,即256)ACK 10000 100 (NUM is: 10000, that is, the total number of fragments is 32, SZX is 100, that is, 4, indicating that the fragment capacity is 2 to the 8th power, that is, 256)
此设计省掉了一个比特位(Bit),即把M位给省掉了,技术优势是节省了数据流量并且对现有设计的改动不大。在这种实施方式中,分片容量(SZX)字段每次仍然要发送。This design saves one bit (Bit), that is, the M bit is saved. The technical advantage is that the data traffic is saved and there is little change to the existing design. In this implementation, the Fragment Size (SZX) field is still sent each time.
在现有技术中,分片容量(即SZX字段)每次都要发送,不管是在请求消息中还是响应消息中,除了第一个分片和最后一个分片中使用的分片容量可能不一样之外,其他的分片容量全部都是一样的。重复互相传输相同的NUM字段浪费了传输资源。In the existing technology, the fragment capacity (ie, the SZX field) is sent every time, no matter in the request message or the response message, except that the fragment capacity used in the first fragment and the last fragment may not be Except for the same, the capacities of other fragments are all the same. Repeatedly transmitting the same NUM field to each other wastes transmission resources.
在本发明实施例中,网关在<Get>方法的请求中使用Block Option时,如果NUM被设置为0,表示双方只进行分片容量的协商,以及分片总数的协商。即传感器在响应中,使用NUM字段返回总的分片数,使用SZX字段返回传感器确定的分片容量。并且网关和传感器双方存储所确定的分片容量,用于之后的分片数据传输消息。除了最后一个分片数据之外。网关在后续<Get>方法的请求中,只发送所请求的当前分片序号,而不发送已经确定并保持不变的分片容量,而且传感器在响应消息中,也只发送当前的分片序号和与该分片序号对应的分片数据,不再发送分片容量。在这种情况下,NUM为1时,表示请求第一个分片的分片数据,依次类推。In the embodiment of the present invention, when the gateway uses the Block Option in the request of the <Get> method, if NUM is set to 0, it means that the two parties only negotiate on the fragment capacity and the total number of fragments. That is, in the response, the sensor uses the NUM field to return the total number of fragments, and uses the SZX field to return the fragment capacity determined by the sensor. And both the gateway and the sensor store the determined fragment capacity for subsequent fragment data transmission messages. Except for the last shard data. In the subsequent <Get> method request, the gateway only sends the requested current fragmentation number, not the determined and unchanged fragmentation capacity, and the sensor only sends the current fragmentation number in the response message And the fragment data corresponding to the fragment sequence number, the fragment capacity is no longer sent. In this case, when NUM is 1, it means that the fragment data of the first fragment is requested, and so on.
以采用<GET>命令从传感器获取数据资源为例,说明上述实施例,Take the <GET> command to obtain data resources from sensors as an example to illustrate the above embodiment,
如图3所示,新的Block Option的设计如下:As shown in Figure 3, the new Block Option is designed as follows:
其中结构(1)用于NUM为0的情况:where structure (1) is used when NUM is 0:
在<Get>请求中,NUM为0,SZX是第二个字节,表示分片容量,TotalNumber表示分片总数,在请求时不使用,不需要携带;在<Get>响应中,NUM为0,SZX表示传感器确定的分片容量,Total Number表示分片总数。In the <Get> request, NUM is 0, SZX is the second byte, which indicates the fragment capacity, and TotalNumber indicates the total number of fragments, which is not used in the request and does not need to be carried; in the <Get> response, NUM is 0 , SZX indicates the shard capacity determined by the sensor, and Total Number indicates the total number of shards.
在现有技术中,分片容量的间隔比较大,比如2048、1024、512,不够灵活。而实际上,512对于一个Block来说,比较小,最好是刚好能够放到一个UDP包里,即1472个字节。本发明对此进行了改进,在一种实施例中,对于SZX,可以采取新的公式,比如:(SZX+1)*8,则其范围可以为:8~2048,但是递减间隔为8。In the existing technology, the interval of fragmentation capacity is relatively large, such as 2048, 1024, 512, which is not flexible enough. In fact, 512 is relatively small for a Block, and it is best to fit it into a UDP packet, that is, 1472 bytes. The present invention improves this. In one embodiment, for SZX, a new formula can be adopted, such as: (SZX+1)*8, then the range can be: 8-2048, but the decreasing interval is 8.
图3中的结构(2)和结构(3)用于<Get>请求中NUM不为0的情况,即获取分片数据时的情况:The structure (2) and structure (3) in Figure 3 are used when the NUM in the <Get> request is not 0, that is, when obtaining fragmented data:
当NUM小于256时,用一个字节来表示分片序号,即结构(2);当NUM大于2的8次方(即256),小于2的16次方(即65536)时,使用两个字节来表示分片序号,即结构(3)。When NUM is less than 256, use one byte to represent the fragment number, that is, structure (2); when NUM is greater than 2 to the 8th power (ie 256) and less than 2 to the 16th power (ie 65536), use two Byte to represent the fragment sequence number, that is, structure (3).
由于结构(2)中的NUM必须大于0,结构(3)中的NUM字段的前一个字节也大于0,因此可以与结构(1)区分开,对于<Get>响应,NUM字段的值与请求中一样,也可以区分开。Since the NUM in structure (2) must be greater than 0, the previous byte of the NUM field in structure (3) is also greater than 0, so it can be distinguished from structure (1). For <Get> responses, the value of the NUM field is the same as The same as in the request, it can also be distinguished.
以下举例说明,消息实例为:The following example illustrates that the message example is:
网关向传感器发送资源获取的请求:The gateway sends a resource acquisition request to the sensor:
GET 00000000 00000101(NUM为0,SZX为101,即5,表示分片容量为2的9次方,即512)GET 00000000 00000101 (NUM is 0, SZX is 101, which is 5, which means that the fragment capacity is 2 to the 9th power, which is 512)
传感器向网关发送的响应:The response sent by the sensor to the gateway:
ACK 00000000 00000100 00000000 00010000(NUM为0,Total Number为10000,即分片总数为32,SZX为100,即4,表示分片容量为2的8次方,即256)。ACK 00000000 00000100 00000000 00010000 (NUM is 0, Total Number is 10000, that is, the total number of fragments is 32, SZX is 100, that is, 4, indicating that the fragment capacity is 2 to the 8th power, that is, 256).
通过对Block Option重新设计,可以在每个请求或响应中至少减少发送4个比特位,在分片较多的情况下,可以极大地提高传输效率,节省传输资源,同时也提高了网关和传感器双方的处理效率。By redesigning the Block Option, at least 4 bits can be sent in each request or response. In the case of many fragments, the transmission efficiency can be greatly improved, transmission resources can be saved, and gateways and sensors can also be improved. processing efficiency on both sides.
图4示出了本发明的一种替代实施例。在图4所示实施例中,ES410至ES420与图2所示实施例的ES210至ES240相同,不再重复描述。Figure 4 shows an alternative embodiment of the invention. In the embodiment shown in FIG. 4 , ES410 to ES420 are the same as ES210 to ES240 in the embodiment shown in FIG. 2 , and will not be described again.
在图4所示实施例中,在ES450,网关向传感器发送<GET>请求,使用分片选项进行分片容量协商,指示网关推荐的分片容量。在ES460中,传感器选择并确定合适的分片容量,用于将资源进行分片,并将所有分片数据主动推送给网关,而不需要网关再发<GET>请求。In the embodiment shown in Fig. 4, at ES450, the gateway sends a <GET> request to the sensor, uses the fragmentation option to negotiate the fragmentation capacity, and indicates the fragmentation capacity recommended by the gateway. In ES460, the sensor selects and determines the appropriate sharding capacity for sharding resources, and actively pushes all sharded data to the gateway without the need for the gateway to send a <GET> request again.
在图4实施例获取数据资源过程中,分片选项的设计如图5所示,其中:In the process of obtaining data resources in the embodiment of Figure 4, the design of the fragmentation option is shown in Figure 5, where:
结构(1)用于网关向传感器发送<GET>请求,SZX字段表示网关推荐的分片容量,传感器最终选择并确定的分片容量小于等于网关推荐的分片容量,NUM为0表示网关请求完整资源,NUM不为0表示网关请求具体第NUM个分片数据,NUM不为0时传感器只能使用SZX字段所指示的分片容量。Structure (1) is used for the gateway to send a <GET> request to the sensor. The SZX field indicates the fragmentation capacity recommended by the gateway. The fragmentation capacity finally selected and determined by the sensor is less than or equal to the fragmentation capacity recommended by the gateway. NUM is 0 to indicate that the gateway request is complete Resource, if NUM is not 0, it means that the gateway requests the specific NUM fragment data, when NUM is not 0, the sensor can only use the fragment capacity indicated by the SZX field.
结构(2)和结构(3)用于传感器向网关返回完整资源的分片响应消息,如果针对某个具体分片数据请求的应答,不需要携带分片选项,结构(2)和(3)中的M字段表示是否为最后一个分片,如果是M字段为0则表示最后一个分片,为1表示不是最后一个分片,NUM字段表示传感器所返回的是第几个分片。Structure (2) and structure (3) are used for the sensor to return a complete resource fragmentation response message to the gateway. If the response to a specific fragmentation data request does not need to carry fragmentation options, structures (2) and (3) The M field in indicates whether it is the last slice, if the M field is 0, it means the last slice, if it is 1, it means it is not the last slice, and the NUM field indicates which slice is returned by the sensor.
以下举例说明。消息实例为:The following example illustrates. Examples of messages are:
网关向传感器发送数据资源获取的请求:The gateway sends a request for data resource acquisition to the sensor:
CON GET 00000000 00000101(NUM为0,SZX为101,即5,表示分片容量为2的9次方,即512)CON GET 00000000 00000101 (NUM is 0, SZX is 101, which is 5, which means that the fragment capacity is 2 to the 9th power, which is 512)
传感器向网关发送的响应:The response sent by the sensor to the gateway:
ACK 200 00000011(NUM为1,M为1,表示发送的第一个分片,并且不是最后一个分片,分片容量为SZX字段指定的容量);ACK 200 00000011 (NUM is 1, M is 1, indicating the first fragment sent, and not the last fragment, and the fragment capacity is the capacity specified by the SZX field);
传感器继续向网关发送CoAP响应:The sensor proceeds to send a CoAP response to the gateway:
CON 200 00000101(NUM为2,M为1,表示发送的第二个分片,并且不是最后一个分片,分片容量为SZX字段指定的容量);CON 200 00000101 (NUM is 2, M is 1, indicating the second fragment sent, and not the last fragment, and the fragment capacity is the capacity specified by the SZX field);
网关返回对CON的ACK响应;The gateway returns an ACK response to CON;
传感器向网关发送最后一个分片:The sensor sends the last fragment to the gateway:
CON 200 00000110(NUM为3,M为0,表示发送的第三个分片,并且是最后一个分片,具体分片容量由实际读出数据算出)。CON 200 00000110 (NUM is 3, M is 0, indicating the third and last fragment sent, and the specific fragment capacity is calculated from the actual read data).
根据图4所示的实施例,在网关从传感器获取完整的数据资源时,仅需完成分片容量的协商,而不用发送大量的分片数据获取请求,大大节省了数据传输流量。According to the embodiment shown in FIG. 4 , when the gateway obtains complete data resources from the sensor, it only needs to complete the negotiation of fragment capacity without sending a large number of fragment data acquisition requests, which greatly saves data transmission traffic.
图6示出了本发明的另一种替代实施例。在图6所示实施例中,ES610至ES640与图2所示实施例的ES210至ES240相同,因此不再重复描述。Figure 6 shows another alternative embodiment of the invention. In the embodiment shown in FIG. 6 , ES610 to ES640 are the same as ES210 to ES240 in the embodiment shown in FIG. 2 , so the description will not be repeated.
图6与图2所示实施例不同之处在于,在ES650,网关向传感器发送<GET>请求,请求获取资源,使用分片选项,指示网关推荐的分片容量,此时NUM字段填充的值为0,表示请求获取最后一个分片;在ES660,传感器响应网关请求,返回确定的分片容量以及最后一个分片的序号及与之对应的分片数据。由于最后一个分片序号对应分片总数,所以在ES670,网关就可以依次或者并发获取其他分片数据的请求。在ES680,传感器根据确定的分片容量,返回该分片的序号及对应的分片数据。ES670和ES680可以多次进行交互,直至分片数据传输完毕。The difference between Figure 6 and the embodiment shown in Figure 2 is that at ES650, the gateway sends a <GET> request to the sensor to request resources, and uses the fragmentation option to indicate the fragmentation capacity recommended by the gateway. At this time, the value filled in the NUM field If it is 0, it means that the last fragment is requested; in ES660, the sensor responds to the gateway request and returns the determined fragment capacity, the sequence number of the last fragment and the corresponding fragment data. Since the last fragment serial number corresponds to the total number of fragments, in ES670, the gateway can sequentially or concurrently obtain requests for other fragment data. In ES680, the sensor returns the sequence number of the fragment and the corresponding fragment data according to the determined fragment capacity. The ES670 and ES680 can interact multiple times until the fragmented data transmission is complete.
图6实施例中采用的分片选项如图7所示,例如采用两个字节的分片选项,仅包括NUM字段和SZX字段。The fragmentation option used in the embodiment of FIG. 6 is shown in FIG. 7 , for example, a two-byte fragmentation option is used, including only the NUM field and the SZX field.
以下结合图6和图7举例说明,消息实例为:The following is an example in conjunction with Figure 6 and Figure 7, and the message example is:
网关向传感器发送资源获取的请求:The gateway sends a resource acquisition request to the sensor:
CON GET 00000000 00000101(NUM为0,表示要求获取最后一个分片,SZX为101,即5,表示推荐的分片容量为2的9次方,即512)。CON GET 00000000 00000101 (NUM is 0, which means that the last fragment is requested, and SZX is 101, which is 5, which means that the recommended fragment capacity is 2 to the 9th power, which is 512).
传感器向网关发送的响应:The response sent by the sensor to the gateway:
ACK 00000000 01000101(NUM为1000即为8,表示返回的是第8个分片,SZX为101即5,表示确定的分片容量为2的9次方,即512);ACK 00000000 01000101 (NUM is 1000, which means 8, which means that the 8th fragment is returned, and SZX is 101, which is 5, which means that the determined fragment capacity is 2 to the 9th power, which is 512);
根据第一次的返回信息,网关已经知道了一共有8个分片,并且得到了第8个分片的数据,网关继续向传感器发送CoAP请求,可以依次获取也可以并发获取剩下的分片数据。以下消息实例为请求获取第一个分片的分片数据:According to the information returned for the first time, the gateway already knows that there are 8 fragments in total, and has obtained the data of the 8th fragment. The gateway continues to send CoAP requests to the sensor, and can obtain the remaining fragments sequentially or concurrently. data. The following message example is a request to obtain the shard data of the first shard:
CON GET 00000000 00001101(NUM为1,表示要求获取第一个分片,SZX为101,即5,表示分片容量为2的9次方,即512);CON GET 00000000 00001101 (NUM is 1, which means that the first fragment is requested, SZX is 101, which is 5, which means that the fragment capacity is 2 to the 9th power, which is 512);
传感器返回对CON的ACK响应,即第一个分片的数据;The sensor returns an ACK response to CON, which is the data of the first fragment;
网关可以依次或并发请求所有剩余分片,直到获取完所有的数据。The gateway can request all remaining shards sequentially or concurrently until all data is fetched.
根据图6所示的实施例,可以在分片容量协商的同时,获取最后一个分片的分片数据,在后续分片数据获取过程中,所使用的分片容量均相同,因此可以结合前述优选实施例的描述,网关可以在发送获取分片数据的请求时,不再发送SZX字段,而仅发送NUM字段,由此可以节省数据流量,提高传输效率。According to the embodiment shown in Figure 6, the fragment data of the last fragment can be acquired while the fragment capacity is being negotiated. In the description of the preferred embodiment, the gateway can no longer send the SZX field but only the NUM field when sending the request to obtain fragmented data, thereby saving data traffic and improving transmission efficiency.
图8示出了使用分片选项向传感器发送数据,例如使用资源创建(Post)或更新(Put)请求时的实施例。以下结合图8进行具体描述。Figure 8 shows an embodiment when sending data to a sensor using the sharding option, for example using a resource create (Post) or update (Put) request. A specific description will be made below in conjunction with FIG. 8 .
图8所示详细的流程说明如下:The detailed process description shown in Figure 8 is as follows:
ES810:网关向传感器发送资源创建(Post)或更新(Put)请求消息,利用Size选项发送资源的容量信息,利用分片选项指示推荐的分片容量及分片总数,此处所述的分片总数是基于推荐的分片容量和待发送的数据资源的容量计算出的,请求消息体中不携带具体的资源数据。ES810: The gateway sends a resource creation (Post) or update (Put) request message to the sensor, uses the Size option to send resource capacity information, and uses the Fragmentation option to indicate the recommended fragmentation capacity and the total number of fragments. The fragmentation described here The total is calculated based on the recommended fragment capacity and the capacity of data resources to be sent, and the request message body does not carry specific resource data.
ES820:传感器如果愿意接收此数据,则返回状态码例如为100(即指示客户端继续发送),同时向网关返回确定的分片容量,所述确定的分片容量只能小于或等于网关推荐的分片容量;如果传感器不愿意接收此数据,则返回错误码指示客户端不要继续发送数据。比如,传感器的存储容量不足以存储所指示的资源容量的数据,则返回413“Request EntityToo Large”的返回码。ES820: If the sensor is willing to receive this data, the return status code is, for example, 100 (that is, instructing the client to continue sending), and at the same time return the determined fragment capacity to the gateway. The determined fragment capacity can only be less than or equal to that recommended by the gateway Fragment capacity; if the sensor is not willing to receive this data, it will return an error code to instruct the client not to continue sending data. For example, if the storage capacity of the sensor is not enough to store the data of the indicated resource capacity, a return code of 413 "Request EntityToo Large" is returned.
ES830:网关根据传感器返回的确定的分片容量,判断是否与推荐的分片容量相同,如果相同,则跳转到ES360;如果不相同,则根据传感器返回的确定的分片容量信息,并根据数据资源容量,重新计算分片总数。ES830: The gateway judges whether it is the same as the recommended fragmentation capacity according to the determined fragmentation capacity returned by the sensor. If it is the same, it jumps to ES360; Data resource capacity, recalculate the total number of shards.
ES840:网关重新向传感器发送确定的分片容量和重新计算的分片总数。ES840: The gateway resends the determined shard capacity and the recalculated total number of shards to the sensor.
ES850:传感器返回确定的分片容量。ES850: Sensor returns determined shard capacity.
ES860:网关从根据分片序号从1一直到分片总数,依次向传感器发送与分片序号对应的数据资源的分片数据,直到完全传输完毕。ES860: The gateway sequentially sends the fragmented data of the data resources corresponding to the fragmented serial number to the sensor from 1 to the total number of fragmented fragments until the transmission is complete.
ES870:传感器返回确定接收的消息,其中包含接收到的分片序号。ES870: The sensor returns a confirmation message, which contains the sequence number of the received fragment.
根据本发明的一种优选实施例,ES860中可以进行并行处理,即网关可以同时向传感器发送多个分片数据,而不需要等待传感器返回对前一个分片消息的响应消息。可选地,根据本发明的一种优选实施例,网关和传感器在消息交互中,增加认证信息。认证消息的配置和交互方式可以采用参照图2所述的相同方式。According to a preferred embodiment of the present invention, parallel processing can be performed in the ES860, that is, the gateway can simultaneously send multiple fragmented data to the sensor without waiting for the sensor to return a response message to the previous fragmented message. Optionally, according to a preferred embodiment of the present invention, the gateway and the sensor add authentication information during message interaction. The configuration and interaction manner of the authentication message may adopt the same manner as described with reference to FIG. 2 .
为了提高传输效率,节省数据流量,根据本发明另一种优选实施例,如前面针对<GET>方法所述地那样,在使用<Put>/<Post>方法的请求中,当NUM为0是,不再是发送第一个分片数据,而是告知传感器推荐的分片的容量和分片总数。传感器可以返回响应告知网关是否继续发送数据。传感器在响应中,使用NUM字段返回总的分片数,使用SZX字段返回传感器确定的分片容量。并且网关和传感器双方存储所确定的分片容量,用于之后的分片数据传输消息。除了最后一个分片数据之外。网关在后续<Put>/<Post>方法的请求中,只发送所请求的当前分片序号,而不发送已经确定并保持不变的分片容量,而且传感器在响应消息中,也只发送当前的分片序号和与该分片序号对应的分片数据,不再发送分片容量。在这种情况下,NUM为1时,表示请求第一个分片的分片数据,依次类推。In order to improve transmission efficiency and save data traffic, according to another preferred embodiment of the present invention, as described above for the <GET> method, in the request using the <Put>/<Post> method, when NUM is 0 , instead of sending the first fragment data, it informs the sensor of the recommended fragment capacity and the total number of fragments. The sensor can return a response telling the gateway whether to continue sending data. In the response, the sensor uses the NUM field to return the total number of shards, and uses the SZX field to return the shard capacity determined by the sensor. And both the gateway and the sensor store the determined fragment capacity for subsequent fragment data transmission messages. Except for the last shard data. In the subsequent <Put>/<Post> method request, the gateway only sends the requested current fragment number, not the fragment capacity that has been determined and remains unchanged, and the sensor only sends the current fragment number in the response message. The fragment sequence number and the fragment data corresponding to the fragment sequence number will no longer send the fragment capacity. In this case, when NUM is 1, it means that the fragment data of the first fragment is requested, and so on.
在此情况下,分片选项的设计以及使用方式均类似于图3所示,以下参照图3来说明。在<Put>/<Post>请求中,NUM字段为0,SZX字段是第二个字节,表示推荐的分片容量,Total Number表示待发送的分片总数数;在<Put>/<Post>响应中,NUM字段为0,SZX字段表示传感器确定的分片容量,Total Number没用,不需要携带;如果网关接收到的SZX字段与发送的不一致,需要用新的SZX再次发送<Put>/<Post>请求,并携带重新计算的分片总数,传感器再发回响应。以后<Put>/<Post>请求和响应中,不再携带SZX字段。In this case, the design and usage of the slice option are similar to those shown in FIG. 3 , which will be described below with reference to FIG. 3 . In the <Put>/<Post> request, the NUM field is 0, the SZX field is the second byte, indicating the recommended fragment capacity, and the Total Number represents the total number of fragments to be sent; in <Put>/<Post >In the response, the NUM field is 0, and the SZX field indicates the fragmentation capacity determined by the sensor. The Total Number is useless and does not need to be carried; if the SZX field received by the gateway is inconsistent with the sent one, it needs to send <Put> again with a new SZX /<Post> request with the recalculated total number of shards, and the sensor sends back a response. In future <Put>/<Post> requests and responses, the SZX field will no longer be carried.
通过对分片选项重新设计,可以在每个请求或响应中至少减少发送4个比特位,在分片较多的情况下,可以极大地提高传输效率,节省传输资源,同时也提高了网关和传感器双方的处理效率。By redesigning the fragmentation option, at least 4 bits can be sent in each request or response. In the case of many fragments, the transmission efficiency can be greatly improved, transmission resources can be saved, and the gateway and Processing efficiency on both sides of the sensor.
另外,现有技术在每次分片传输的请求中,都需要携带所请求资源的统一资源标识(URI,Unified Resource Identifier),通常URI都要占十几到几十个字节,重复的传输会浪费传输资源,本发明设计使用Token(令牌)来关联分片传输的多个请求,只在第一个分片消息中传送URI,在后续的分片传输请求中,只需要携带Token即可,由于Token通常是1~8个字节,因此可以节省一定的流量。In addition, the existing technology needs to carry the unified resource identifier (URI, Unified Resource Identifier) of the requested resource in each fragment transmission request. Usually, the URI occupies more than a dozen to dozens of bytes. Repeated transmission It will waste transmission resources. The present invention designs and uses Token (token) to associate multiple requests for fragment transmission, and only transmits the URI in the first fragment message. In subsequent fragment transmission requests, only the Token needs to be carried. Yes, since Token is usually 1 to 8 bytes, it can save a certain amount of traffic.
图9是本发明一种通过分片传输数据资源的客户端设备的实施例。图9所示客户端设备900包括:获取单元910,用于获取数据资源容量信息;发送单元920,用于发送携带分片选项的请求消息,其中所述分片选项包括推荐的分片容量,接收单元930,接收携带分片选项的响应消息,其中所述分片选项包括确定的分片容量;和传输单元940,用于根据所述确定的分片容量以及所述数据资源容量信息,分片传输所述数据资源。Fig. 9 is an embodiment of a client device for transmitting data resources through fragmentation according to the present invention. The client device 900 shown in FIG. 9 includes: an acquiring unit 910, configured to acquire data resource capacity information; a sending unit 920, configured to send a request message carrying a fragmentation option, wherein the fragmentation option includes a recommended fragmentation capacity, The receiving unit 930 is configured to receive a response message carrying a fragmentation option, wherein the fragmentation option includes a determined fragmentation capacity; and a transmission unit 940 is configured to, according to the determined fragmentation capacity and the data resource capacity information, divide The data resource is transferred in slices.
根据本发明的一种优选实施例,所述客户端设备可以进一步包括存储单元950,用于保存所述确定的分片容量。以便在数据资源传输过程中,不需要每次均发送SZX字段。According to a preferred embodiment of the present invention, the client device may further include a storage unit 950, configured to store the determined slice capacity. So that in the data resource transmission process, the SZX field does not need to be sent every time.
根据本发明的另一种优选实施例,所述客户端设备可以进一步包括认证单元960,用于发送和接收认证信息。According to another preferred embodiment of the present invention, the client device may further include an authentication unit 960, configured to send and receive authentication information.
图10是本发明一种通过分片传输数据资源的服务器设备的实施例。图10所示服务器设备1000包括:接收单元1010,用于接收携带分片选项的请求消息,其中所述分片选项包括推荐的分片容量;发送单元1020,用于发送携带分片选项的响应消息,其中所述分片选项包括确定的分片容量;和传输单元1030,用于根据所述确定的分片容量,分片传输所述数据资源。Fig. 10 is an embodiment of a server device for transmitting data resources through fragmentation according to the present invention. The server device 1000 shown in Figure 10 includes: a receiving unit 1010, configured to receive a request message carrying a fragmentation option, wherein the fragmentation option includes a recommended fragmentation capacity; a sending unit 1020, configured to send a response carrying a fragmentation option message, wherein the fragmentation option includes a determined fragmentation capacity; and a transmission unit 1030, configured to transmit the data resources in fragments according to the determined fragmentation capacity.
根据本发明一种实施例,发送单元1020还用于发送携带数据资源容量信息的消息,以便于传输单元1030根据所述确定的分片容量和所述数据资源容量信息,分片传输所述数据资源。According to an embodiment of the present invention, the sending unit 1020 is further configured to send a message carrying data resource capacity information, so that the transmission unit 1030 transmits the data in fragments according to the determined fragment capacity and the data resource capacity information resource.
根据本发明一种实施例,在接收到一次请求时,传输单元1030可以主动地分片传输数据,而不需要客户端设备针对每个分片数据进行请求。According to an embodiment of the present invention, upon receiving a request, the transmission unit 1030 may actively transmit data in pieces, without requiring the client device to request for each piece of data.
根据本发明一种优选实施例,所述服务器设备可以进一步包括存储单元1040,用于保存所述确定的分片容量。以便在数据资源传输过程中,不需要每次均发送SZX字段。According to a preferred embodiment of the present invention, the server device may further include a storage unit 1040, configured to store the determined fragment capacity. So that in the data resource transmission process, the SZX field does not need to be sent every time.
根据本发明的另一种优选实施例,所述服务器设备可以进一步包括认证单元1050,用于发送和接收认证信息。According to another preferred embodiment of the present invention, the server device may further include an authentication unit 1050, configured to send and receive authentication information.
根据本发明实施例,网关可以获知目标资源的容量信息,用于决策是否用分片的方式来获取资源,这样避免了出错的可能性,也可以实现并发地请求分片,提高数据请求的效率,而且得知资源的容量也便于分配存储空间,计算分片的数量。According to the embodiment of the present invention, the gateway can obtain the capacity information of the target resource, and use it to decide whether to obtain the resource in a fragmented manner, which avoids the possibility of errors, and can also request fragments concurrently, improving the efficiency of data requests , and knowing the resource capacity is also convenient for allocating storage space and calculating the number of fragments.
通过对分片选项重新设计,可以在每个请求或响应中至少少发送4个比特位,在分片较多的情况下,可以极大地提高传输效率,节省传输资源,同时也提高了双方的处理效率。By redesigning the fragmentation option, at least 4 bits can be sent in each request or response. In the case of many fragments, the transmission efficiency can be greatly improved, the transmission resources can be saved, and the communication between the two parties can also be improved. Processing efficiency.
在现有技术中,在收到来自于客户端的请求后,服务器可以立即发回响应,也可以先发回一个Ack(Acknowledgement)响应消息,表明接收到了请求消息,正在处理中,后续等处理完后,再发送响应消息,即推迟的响应。另外,客户端可以订阅一个资源的改变,服务器在接受客户端对某个资源的订阅后,一旦资源信息发生变化,就向客户端发回通知消息。In the existing technology, after receiving the request from the client, the server can send back a response immediately, or send back an Ack (Acknowledgment) response message first, indicating that the request message has been received and is being processed, and the subsequent processing is completed After that, send the response message, that is, the delayed response. In addition, the client can subscribe to the change of a resource. After the server accepts the client's subscription to a resource, once the resource information changes, it will send back a notification message to the client.
现有技术不能满足如下的需求:The prior art cannot meet the following requirements:
1、客户端在请求中指示服务器,自己需要哪种方式的响应;1. The client indicates to the server in the request which response it needs;
2、客户端要求服务器在某个规定的时间内发回响应;2. The client requests the server to send back a response within a specified time;
3、在通知消息的传送过程中,由于网络传输能力不稳定,可能服务器先发出的通知消息,比服务器后发出的消息,到达客户端的时间要晚。这样,客户端后收到的资源信息实际上是陈旧的信息,客户端需要有一种机制能够探测多个通知消息的顺序。3. During the transmission of the notification message, due to the unstable network transmission capacity, the notification message sent by the server first may reach the client later than the message sent by the server later. In this way, the resource information received later by the client is actually old information, and the client needs to have a mechanism to detect the sequence of multiple notification messages.
图11是本发明一种实施例的流程图。在图11所示实施例中,在S1110,客户端向服务器发送请求消息,该请求消息携带响应方式选项,所述响应方式选项可以是推迟响应(Deferred Response)选项或者是令牌(Token)选项,用来指示服务器,客户端是否接收推迟的响应。例如,所述相应方式选项表示:一次性的立即响应、推迟的一次性的响应、推迟的多个响应和取消推迟的多个响应。然后,在S1120,客户端可以接收根据响应方式选项生成的响应消息。Figure 11 is a flowchart of an embodiment of the present invention. In the embodiment shown in FIG. 11, at S1110, the client sends a request message to the server, and the request message carries a response mode option, and the response mode option may be a Deferred Response option or a Token option , used to indicate to the server, whether the client accepts deferred responses. For example, the corresponding mode options represent: one-time immediate response, deferred one-time response, deferred multiple responses, and cancel-deferred multiple responses. Then, at S1120, the client may receive the response message generated according to the response mode option.
在现有技术中,在收到来自于客户端的请求后,服务器可以立即发回响应,也可以先发回一个Ack,表明接收到了请求消息,正在处理中,后续等处理完后,再发送响应消息,即推迟的响应。另外,客户端可以订阅一个资源的改变,服务器在接受客户端对某个资源的订阅后,一旦资源信息发生变化,就向客户端发回通知消息。In the existing technology, after receiving the request from the client, the server can send back a response immediately, or send back an Ack first, indicating that the request message has been received and is being processed, and then send the response after the subsequent processing is completed Message, that is, the delayed response. In addition, the client can subscribe to the change of a resource. After the server accepts the client's subscription to a resource, once the resource information changes, it will send back a notification message to the client.
在本发明的一种实施例中,例如可以采用一个字节的延迟(Deferred)选项来指示响应方式,其中,可以使用前两个比特位(Bit)来表示,用C来表示:In an embodiment of the present invention, for example, a one-byte Deferred option can be used to indicate the response mode, wherein the first two bits (Bit) can be used to indicate, and C is used to indicate:
C=00:表示一次性的立即响应;C=00: Indicates a one-time immediate response;
C=01:表示推迟的一次性的响应;C=01: Indicates a delayed one-off response;
C=10:表示推迟的多个响应,即订阅;C=10: Indicates delayed multiple responses, ie subscription;
C=11:表示取消推迟的多个响应,即取消订阅。C=11: Indicates canceling the postponed multiple responses, that is, unsubscribing.
对于客户端发起的关于某个资源的订阅,可以由客户端取消订阅,也可以服务器取消订阅,比如服务器发回给客户端一个需要确认的响应消息,客户端在预定的时间内未能确认,则服务器可以认为客户端失去连接,从而取消订阅。For a subscription to a resource initiated by the client, the client can cancel the subscription, or the server can cancel the subscription. For example, the server sends back a response message that needs to be confirmed, and the client fails to confirm within the predetermined time. Then the server can think that the client has lost connection and cancel the subscription.
由于一个字节是8个比特位,多余的后6个比特位(假设其值为T)可以用于表示推迟的一次性的响应的推迟时间或者推迟的多个响应的截止时间,即超过此时间后,自动取消订阅。当C为01时,T表示推迟的一次性响应的推迟时间;当C为10时,T表示推迟的多个响应的截止时间;当T为00或11时,T没有意义,置为0。Since a byte is 8 bits, the extra last 6 bits (assuming its value is T) can be used to indicate the delay time of a delayed one-time response or the deadline of multiple delayed responses, that is, beyond this After the time, the subscription is automatically unsubscribed. When C is 01, T represents the delayed one-time response delay time; when C is 10, T represents the deadline for multiple delayed responses; when T is 00 or 11, T has no meaning and is set to 0.
对于这6个比特位,可以表示0~63之间的数值,假设为T,可以用2的T次方,来表明这个时间长度,以秒为单位,即可以表示1~2^63秒。比如:For these 6 bits, it can represent a value between 0 and 63. Assuming T, you can use 2 to the T power to indicate the length of time. In seconds, it can represent 1 to 2^63 seconds. for example:
0:2^0=1秒;0: 2^0 = 1 second;
1:2^1=2秒;1: 2^1=2 seconds;
2:2^2=4秒;2: 2^2 = 4 seconds;
3:2^3=8秒3: 2^3 = 8 seconds
4:2^4=16秒;4: 2^4 = 16 seconds;
63:2^63秒。63: 2^63 seconds.
在现有技术中,Max_Age字段用于表明某个响应可以被缓存的最大时间,即表明响应的新鲜度。本发明扩展这一字段的含义,可以在请求中用Max_Age字段表示多个响应之间的时间间隔的限制,比如多个通知消息不得高于此时间间隔,或者是不得低于此时间间隔。In the prior art, the Max_Age field is used to indicate the maximum time that a certain response can be cached, that is, to indicate the freshness of the response. The present invention expands the meaning of this field, and can use the Max_Age field in the request to indicate the limitation of the time interval between multiple responses, for example, multiple notification messages must not be higher than this time interval, or must not be lower than this time interval.
对于多个响应的顺序,可以用消息标识(Message ID)来区分。比如,规定消息标识必须根据通响应的顺序来递增地生成,接收方根据消息标识的大小来判断响应的先后顺序。The sequence of multiple responses can be distinguished by message ID (Message ID). For example, it is stipulated that message identifiers must be incrementally generated according to the order of responses, and the receiver judges the sequence of responses based on the size of the message identifiers.
根据本发明的另一种实施例,可以使用Token(令牌)选项来指示响应方式,如果Token值为0,来表示立即的响应,如果Token值不为0,则表示可以接受推迟的响应。According to another embodiment of the present invention, the Token (token) option can be used to indicate the response mode. If the Token value is 0, it indicates an immediate response, and if the Token value is not 0, it indicates that a delayed response can be accepted.
根据本发明的另一种实施例,可以替代地或另外增加时间戳(Timestamp)选项,与延迟选项单独或者相结合地来指示响应方式。具体来说,客户端可以在请求中携带时间戳选项,所述时间戳选项包括一个截止时间的值,要求服务器在指定的时间内返回响应;服务器在响应消息中,携带时间戳选项,表明响应消息生成的时间,这样,客户端可以基于时间戳选项来判断响应消息的顺序。According to another embodiment of the present invention, a timestamp (Timestamp) option may be added alternatively or additionally, and the delay option may be used alone or in combination to indicate the response mode. Specifically, the client can carry a timestamp option in the request, and the timestamp option includes a deadline value, requiring the server to return a response within a specified time; the server carries a timestamp option in the response message, indicating that the response The time when the message was generated, so that the client can determine the order of the response messages based on the timestamp option.
在本发明一种实施例中,所述时间戳选项的设计方案可以用1~6个字节来表示,如果表示的时间短,则用一个字节,如果时间长,则用3个字节或6个字节。具体表示方法例如以下两种:In an embodiment of the present invention, the design scheme of the timestamp option can be represented by 1 to 6 bytes, if the represented time is short, use 1 byte, if the time is long, use 3 bytes or 6 bytes. The specific representation methods are as follows:
(1)用年、月、日、时、分、秒来表示,第一个字节表示年、第二个字节表示月,第三个字节表示日,第四个字节表示小时,第五个字节表示分钟,第六个字节表示秒,对于年份,例如可以以2000年为基础,其值表明2000年之后的第几年,比如为0时,表明是2000年,为1时,表明是2001年,最多可以表示2063年。(1) Use year, month, day, hour, minute, second to represent, the first byte represents the year, the second byte represents the month, the third byte represents the day, and the fourth byte represents the hour, The fifth byte represents the minute, and the sixth byte represents the second. For the year, for example, it can be based on 2000, and its value indicates the number of years after 2000. For example, when it is 0, it indicates that it is 2000, and it is 1. The time indicates the year 2001, and it can indicate the year 2063 at most.
(2)三个字节全部用秒来表示,最大可表示2^24-1秒,大约是136年。(2) All three bytes are represented by seconds, and the maximum can represent 2^24-1 seconds, which is about 136 years.
由此,客户端可以知道返回的响应消息的顺序,避免数据传输延迟导致的错误。Thus, the client can know the order of the returned response messages, and avoid errors caused by data transmission delays.
图12是根据本发明的一种传输数据资源的客户端设备的实施例的框图,其中所述客户端设备1200包括:发送模块1210,用于发送携带响应方式选项的请求消息;和接收模块1220,用于接收根据所述响应方式选项生成的响应消息。Fig. 12 is a block diagram of an embodiment of a client device for transmitting data resources according to the present invention, wherein the client device 1200 includes: a sending module 1210, configured to send a request message carrying a response mode option; and a receiving module 1220 , used to receive the response message generated according to the response mode option.
参照图11所述的本发明的实施例所描述的过程和特征均适用于图12所示的客户端设备。具体来说,例如,发送模块1210发送的请求消息中携带的响应方式选项可以是推迟选项,例如可以为:一次性的立即响应、推迟的一次性的响应、推迟的多个响应和取消推迟的多个响应。The procedures and features described in the embodiment of the present invention with reference to FIG. 11 are applicable to the client device shown in FIG. 12 . Specifically, for example, the response mode option carried in the request message sent by the sending module 1210 may be a postponement option, for example, it may be: a one-time immediate response, a delayed one-time response, multiple delayed responses, and a canceled postponed multiple responses.
根据一种实施例,发送模块1210发送的请求消息中携带的响应方式选项可以表示推迟的一次性的响应的推迟时间或者推迟的多个响应的截止时间。According to an embodiment, the response mode option carried in the request message sent by the sending module 1210 may indicate a delayed one-time delayed response time or delayed deadlines for multiple responses.
根据一种实施例,发送模块1210发送携带时间戳选项的请求消息,该时间戳表示接收响应的截止时间;接收模块1220接收携带时间戳选项的响应消息,该时间戳表示响应消息的生成时间。接收模块1220根据接收到的响应消息中的时间戳所表示的时间确定响应消息的顺序。According to an embodiment, the sending module 1210 sends a request message carrying a timestamp option, and the timestamp indicates a deadline for receiving a response; the receiving module 1220 receives a response message carrying a timestamp option, and the timestamp indicates a generation time of the response message. The receiving module 1220 determines the order of the response messages according to the time represented by the timestamp in the received response messages.
图13是根据本发明的一种传输数据资源的服务器设备的实施例,其中所述服务器设备1300包括:接收模块1310,用于接收携带响应方式选项的请求消息;和发送模块1320,发送根据所述响应方式选项生成的响应消息。Fig. 13 is an embodiment of a server device for transmitting data resources according to the present invention, wherein the server device 1300 includes: a receiving module 1310, configured to receive a request message carrying a response mode option; and a sending module 1320, configured to send Response message generated by the Response Mode option described above.
参照图11所述的本发明的实施例所描述的过程和特征均适用于图13所示的服务器设备。具体来说,例如,接收模块1310接收的请求消息中携带的响应方式选项可以是推迟选项,例如可以为:一次性的立即响应、推迟的一次性的响应、推迟的多个响应和取消推迟的多个响应。The processes and features described in the embodiment of the present invention with reference to FIG. 11 are applicable to the server device shown in FIG. 13 . Specifically, for example, the response mode option carried in the request message received by the receiving module 1310 may be a postponement option, for example, it may be: a one-time immediate response, a delayed one-time response, multiple delayed responses, and a canceled postponed multiple responses.
根据本发明的一种实施例,接收模块1310接收的请求消息中携带的响应方式选项可以表示推迟的一次性的响应的推迟时间或者推迟的多个响应的截止时间。According to an embodiment of the present invention, the response mode option carried in the request message received by the receiving module 1310 may indicate a delayed one-time delayed response time or delayed multiple response deadlines.
根据本发明的一种实施例,接收模块1310接收的请求消息中的推迟选项表示推迟的多个响应和推迟的多个响应之间的时间间隔,而发送模块1320发送的响应消息中的推迟选项表示取消推迟的多个响应。According to an embodiment of the present invention, the postponement option in the request message received by the receiving module 1310 indicates the delayed multiple responses and the time interval between the delayed multiple responses, and the postponement option in the response message sent by the sending module 1320 Indicates cancellation of deferred multiple responses.
根据本发明的另一种实施例,接收模块1310接收的请求消息中可以携带时间戳选项,该时间戳选项表示接收响应的截止时间,而发送模块1320发送的响应消息中也可以携带时间戳选项,所述时间戳选项表示响应消息的生成时间。According to another embodiment of the present invention, the request message received by the receiving module 1310 may carry a timestamp option, which indicates the deadline for receiving the response, and the response message sent by the sending module 1320 may also carry the timestamp option , the timestamp option indicates the generation time of the response message.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the relationship between hardware and software Interchangeability. In the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
尽管已示出和描述了本发明的一些实施例,但本领域技术人员应理解,在不脱离本发明的原理和精神的情况下,可对这些实施例进行各种修改,这样的修改应落入本发明的范围内。Although some embodiments of the present invention have been shown and described, those skilled in the art will understand that various modifications can be made to these embodiments without departing from the principles and spirit of the invention, and such modifications shall fall within into the scope of the present invention.
Claims (23)
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710132013.8A CN106850841B (en) | 2011-03-17 | 2012-03-02 | Method and device for transmitting data resources |
CN201710131638.2A CN107070990B (en) | 2011-03-17 | 2012-03-02 | Method and device for data resource transmission |
CN201210054892.4A CN102685203B (en) | 2011-03-17 | 2012-03-02 | The method and apparatus of transmitting data resources |
Applications Claiming Priority (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110064549.3 | 2011-03-17 | ||
CN2011100645493A CN102130954A (en) | 2011-03-17 | 2011-03-17 | Method and device for data resource transmission |
CN2011100645493 | 2011-03-17 | ||
CN201210054892.4A CN102685203B (en) | 2011-03-17 | 2012-03-02 | The method and apparatus of transmitting data resources |
Related Child Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710132013.8A Division CN106850841B (en) | 2011-03-17 | 2012-03-02 | Method and device for transmitting data resources |
CN201710131638.2A Division CN107070990B (en) | 2011-03-17 | 2012-03-02 | Method and device for data resource transmission |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102685203A CN102685203A (en) | 2012-09-19 |
CN102685203B true CN102685203B (en) | 2017-07-07 |
Family
ID=44268843
Family Applications (7)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2011100645493A Pending CN102130954A (en) | 2011-03-17 | 2011-03-17 | Method and device for data resource transmission |
CN201210054892.4A Active CN102685203B (en) | 2011-03-17 | 2012-03-02 | The method and apparatus of transmitting data resources |
CN201710132013.8A Active CN106850841B (en) | 2011-03-17 | 2012-03-02 | Method and device for transmitting data resources |
CN201710131638.2A Active CN107070990B (en) | 2011-03-17 | 2012-03-02 | Method and device for data resource transmission |
CN201210056456.0A Active CN102685204B (en) | 2011-03-17 | 2012-03-06 | Method and equipment for transmitting data resource |
CN201710131415.6A Active CN106878442B (en) | 2011-03-17 | 2012-03-06 | Method and device for data resource transmission |
CN201710132014.2A Active CN107071826B (en) | 2011-03-17 | 2012-03-06 | Method and device for data resource transmission |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2011100645493A Pending CN102130954A (en) | 2011-03-17 | 2011-03-17 | Method and device for data resource transmission |
Family Applications After (5)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710132013.8A Active CN106850841B (en) | 2011-03-17 | 2012-03-02 | Method and device for transmitting data resources |
CN201710131638.2A Active CN107070990B (en) | 2011-03-17 | 2012-03-02 | Method and device for data resource transmission |
CN201210056456.0A Active CN102685204B (en) | 2011-03-17 | 2012-03-06 | Method and equipment for transmitting data resource |
CN201710131415.6A Active CN106878442B (en) | 2011-03-17 | 2012-03-06 | Method and device for data resource transmission |
CN201710132014.2A Active CN107071826B (en) | 2011-03-17 | 2012-03-06 | Method and device for data resource transmission |
Country Status (1)
Country | Link |
---|---|
CN (7) | CN102130954A (en) |
Families Citing this family (40)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103227803A (en) * | 2012-01-30 | 2013-07-31 | 华为技术有限公司 | Internet of thing resource obtaining method, client and internet of thing resource devices |
CN103780483A (en) * | 2012-10-26 | 2014-05-07 | 中兴通讯股份有限公司 | Method, system and device for obtaining resource information of terminal device of Internet of Thingss |
CN103428273B (en) * | 2013-07-18 | 2016-12-28 | 北京百度网讯科技有限公司 | The method and apparatus of response inquiry is carried out in asynchronous system is mutual |
WO2015070441A1 (en) * | 2013-11-15 | 2015-05-21 | 华为技术有限公司 | M2m network and application, common services entity, and information reply method |
CN104468594B (en) * | 2014-12-15 | 2018-04-27 | 北京奇安信科技有限公司 | The method, apparatus and system of a kind of request of data |
CN104580396B (en) * | 2014-12-19 | 2018-07-20 | 华为技术有限公司 | A kind of method for scheduling task, node and system |
CN107960151B (en) * | 2015-05-04 | 2020-11-06 | 瑞典爱立信有限公司 | Response device and request device in wireless communication system and implementation method thereof |
CN106658348A (en) * | 2015-10-28 | 2017-05-10 | 西安中兴新软件有限责任公司 | Method and device for managing monitoring resources and CSE |
CN106817314B (en) * | 2015-12-02 | 2020-03-20 | 中国电信股份有限公司 | Big data acquisition method, device and system |
CN105868029A (en) * | 2015-12-11 | 2016-08-17 | 鼎点视讯科技有限公司 | Consistency fault-tolerance processing method and system |
CN107222450A (en) * | 2016-03-21 | 2017-09-29 | 中兴通讯股份有限公司 | A kind of network node and realize the method and apparatus communicated between network node |
CN106303059A (en) * | 2016-08-24 | 2017-01-04 | 努比亚技术有限公司 | Electronic equipment and information processing method |
CN106331117B (en) * | 2016-08-26 | 2019-05-03 | 中国科学技术大学 | a data transfer method |
CN106790603A (en) * | 2016-12-29 | 2017-05-31 | 东软集团股份有限公司 | The method of interacting message, apparatus and system |
US10191825B2 (en) * | 2017-03-01 | 2019-01-29 | Wipro Limited | System and method for testing a device using a light weight device validation protocol |
CN107105035A (en) * | 2017-04-24 | 2017-08-29 | 常州信息职业技术学院 | A kind of smart home supervising device and monitoring system |
CN108809858B (en) * | 2017-04-28 | 2020-11-10 | 华为技术有限公司 | Network congestion control method, device and system |
CN109586855A (en) * | 2017-09-29 | 2019-04-05 | 西安中兴新软件有限责任公司 | A kind of mobile unit data transmission method and device |
CN109729039B (en) * | 2017-10-27 | 2022-05-13 | 中兴通讯股份有限公司 | Negotiated fragmentation method and device for link management protocol |
CN107864135A (en) * | 2017-11-07 | 2018-03-30 | 山东网智物联网科技有限公司 | The realization device of Internet of Things communication means, device and Internet of Things Network Communication |
CN109936588B (en) * | 2017-12-15 | 2021-08-31 | 华为技术有限公司 | A kind of Internet of things data transmission method, equipment and system |
CN108599904B (en) * | 2018-03-21 | 2021-09-28 | 中兴通讯股份有限公司 | Data transmission method and device |
CN108834110B (en) * | 2018-05-30 | 2021-05-25 | 上海顺舟智能科技股份有限公司 | Data transmission control method and system for zigbee network |
CN108900370B (en) * | 2018-06-08 | 2021-12-17 | 努比亚技术有限公司 | Long connection multiple timeout judging method, device and computer readable storage medium |
CN110636551B (en) * | 2018-06-25 | 2022-05-17 | 上海华为技术有限公司 | Method and device for avoiding message fragmentation |
CN110875952A (en) * | 2018-09-04 | 2020-03-10 | 中国移动通信有限公司研究院 | A data response processing method, device and storage medium based on the Internet of Things |
CN110881021B (en) * | 2018-09-06 | 2022-06-03 | 中国移动通信有限公司研究院 | Method and device for processing MSRP fragmentation, network equipment and storage medium |
CN109787884B (en) * | 2019-01-02 | 2021-03-12 | 中国联合网络通信集团有限公司 | Message pushing method and device |
KR102622252B1 (en) * | 2019-05-27 | 2024-01-08 | 삼성에스디에스 주식회사 | Apparatus and method for transmitting contents |
EP4079009B1 (en) | 2019-12-17 | 2025-02-05 | Telefonaktiebolaget Lm Ericsson (Publ) | Observation of resources by a coap client |
CN111083161A (en) * | 2019-12-27 | 2020-04-28 | 中消云(北京)物联网科技研究院有限公司 | Data transmission processing method and device and Internet of things equipment |
CN111259371B (en) * | 2020-01-13 | 2023-08-18 | 平安科技(深圳)有限公司 | Internet of things equipment authentication method, electronic device and storage medium |
CN112187931A (en) * | 2020-09-29 | 2021-01-05 | 中国平安财产保险股份有限公司 | Session management method, device, computer equipment and storage medium |
CN112367387A (en) * | 2020-10-30 | 2021-02-12 | 湖北亿咖通科技有限公司 | Internet of vehicles communication method and system |
CN112541788B (en) * | 2020-12-11 | 2023-11-17 | 江西蔚乐科技有限公司 | Advertisement request method based on COAP protocol |
CN114125746B (en) * | 2021-11-19 | 2022-08-16 | 山东华科信息技术有限公司 | Dynamic CoAP mode selection method and device based on UCB |
CN114363831B (en) * | 2021-12-02 | 2023-05-26 | 北京万集科技股份有限公司 | Method, apparatus and computer readable storage medium for transmitting V2X message |
CN114884913B (en) * | 2022-01-10 | 2025-04-01 | 中国移动通信有限公司研究院 | Message interaction method, device, electronic device, message server and storage medium |
CN115103005B (en) * | 2022-06-14 | 2024-08-16 | 北京京东乾石科技有限公司 | Request response method, request response device, electronic equipment and storage medium |
CN118283833A (en) * | 2022-12-29 | 2024-07-02 | 维沃移动通信有限公司 | Resource determination method and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1905518A (en) * | 2005-07-29 | 2007-01-31 | 北京航空航天大学 | Method for ensuring reliable transmission of data exhange |
CN101102282A (en) * | 2007-08-08 | 2008-01-09 | 中兴通讯股份有限公司 | A transmission and receiving method for data broadcast service |
CN101729593A (en) * | 2008-11-03 | 2010-06-09 | 北大方正集团有限公司 | Method, system and device for uploading and receiving file |
Family Cites Families (28)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5909542A (en) * | 1996-11-20 | 1999-06-01 | Cfi Proservices, Inc. | Distributed computing system for executing intercommunicating applications programs |
US6680921B1 (en) * | 1999-06-18 | 2004-01-20 | Telefonaktiebolaget Lm Ericsson (Publ) | Estimation of time stamps in real-time packet communications |
US7239648B1 (en) * | 2001-11-27 | 2007-07-03 | Marvell International Ltd. | Extension mode for wireless lans complying with short interframe space requirement |
US20030202487A1 (en) * | 2002-04-26 | 2003-10-30 | Harris John M. | Method and apparatus for reducing call setup time |
US9886309B2 (en) * | 2002-06-28 | 2018-02-06 | Microsoft Technology Licensing, Llc | Identity-based distributed computing for device resources |
KR20040087161A (en) * | 2003-04-04 | 2004-10-13 | 엘지전자 주식회사 | File content management method for mobile communication terminal |
WO2006020934A2 (en) * | 2004-08-13 | 2006-02-23 | Conexant Systems, Inc. | Systems and methods for decreasing latency in a digital transmission system |
CN100349088C (en) * | 2005-07-26 | 2007-11-14 | 华为技术有限公司 | Digital information controlling method |
WO2007051079A2 (en) * | 2005-10-28 | 2007-05-03 | Viasat, Inc. | Adaptive coding and modulation for broadband data transmission |
CN100461673C (en) * | 2005-12-02 | 2009-02-11 | 华为技术有限公司 | A data packet interaction method and personal area network communication equipment |
CN100490380C (en) * | 2005-12-26 | 2009-05-20 | 北大方正集团有限公司 | Light distributed file storage system file uploading method |
CN101155054A (en) * | 2006-09-28 | 2008-04-02 | 华为技术有限公司 | Method and device for automatic detection and calculation of inter-autonomous system PCE paths |
JP2008271312A (en) * | 2007-04-23 | 2008-11-06 | Matsushita Electric Ind Co Ltd | Wireless packet communication device |
US20080275808A1 (en) * | 2007-05-01 | 2008-11-06 | Instinet Europe Limited | Anonymous block trade matching system |
CN101335742B (en) * | 2007-06-25 | 2011-09-21 | 中兴通讯股份有限公司 | A system and method for accessing directories under a lightweight directory access protocol |
CN101374020B (en) * | 2007-08-20 | 2012-11-14 | 中兴通讯股份有限公司 | Centralized bandwidth distribution method for relay network |
CN101150506B (en) * | 2007-08-24 | 2011-07-06 | 华为技术有限公司 | Content acquisition method, device and content transmission system |
CN101471992B (en) * | 2007-12-24 | 2012-05-09 | 联想(北京)有限公司 | Mobile terminal and method for receiving or sending business information, and push-pull server |
CN101217402B (en) * | 2008-01-15 | 2012-01-04 | 杭州华三通信技术有限公司 | A method to enhance the reliability of the cluster and a high reliability communication node |
CN101222395B (en) * | 2008-02-03 | 2010-10-27 | 华为技术有限公司 | Method, system and device for selecting network boot configuration information |
CN101635703A (en) * | 2008-07-24 | 2010-01-27 | 北京启明星辰信息技术股份有限公司 | Method for detecting WEB service abnormality |
CN101741701B (en) * | 2008-11-12 | 2012-01-11 | 中兴通讯股份有限公司 | Synchronous dispatching method and synchronous dispatching device |
CN101867882B (en) * | 2009-04-14 | 2015-10-21 | 中兴通讯股份有限公司 | Message sends and message feedback preprocess method |
KR20100127189A (en) * | 2009-05-25 | 2010-12-03 | 엘지전자 주식회사 | Method of performing bandwidth request and terminal device for same |
CN101945427B (en) * | 2009-07-03 | 2012-11-14 | 深圳市融创天下科技股份有限公司 | Efficient streaming media transmission method |
CN101635744B (en) * | 2009-08-26 | 2012-08-29 | 华为技术有限公司 | Method and system for transmitting data and relative equipment |
CN101789958B (en) * | 2009-12-30 | 2013-06-05 | 中兴通讯股份有限公司 | Method, system and equipment of data synchronization based on equipment management service |
US10448390B2 (en) * | 2014-12-19 | 2019-10-15 | Qualcomm Incorporated | Transmission techniques for enabling an immediate response |
-
2011
- 2011-03-17 CN CN2011100645493A patent/CN102130954A/en active Pending
-
2012
- 2012-03-02 CN CN201210054892.4A patent/CN102685203B/en active Active
- 2012-03-02 CN CN201710132013.8A patent/CN106850841B/en active Active
- 2012-03-02 CN CN201710131638.2A patent/CN107070990B/en active Active
- 2012-03-06 CN CN201210056456.0A patent/CN102685204B/en active Active
- 2012-03-06 CN CN201710131415.6A patent/CN106878442B/en active Active
- 2012-03-06 CN CN201710132014.2A patent/CN107071826B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1905518A (en) * | 2005-07-29 | 2007-01-31 | 北京航空航天大学 | Method for ensuring reliable transmission of data exhange |
CN101102282A (en) * | 2007-08-08 | 2008-01-09 | 中兴通讯股份有限公司 | A transmission and receiving method for data broadcast service |
CN101729593A (en) * | 2008-11-03 | 2010-06-09 | 北大方正集团有限公司 | Method, system and device for uploading and receiving file |
Also Published As
Publication number | Publication date |
---|---|
CN102685203A (en) | 2012-09-19 |
CN106878442A (en) | 2017-06-20 |
CN102685204B (en) | 2017-04-26 |
CN107071826B (en) | 2020-07-07 |
CN106850841A (en) | 2017-06-13 |
CN107071826A (en) | 2017-08-18 |
CN106878442B (en) | 2020-12-04 |
CN107070990B (en) | 2021-04-09 |
CN106850841B (en) | 2020-11-17 |
CN107070990A (en) | 2017-08-18 |
CN102685204A (en) | 2012-09-19 |
CN102130954A (en) | 2011-07-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102685203B (en) | The method and apparatus of transmitting data resources | |
US11064330B2 (en) | Methods for enabling delay-awareness in the constrained application protocol (CoAP) | |
CN109412946B (en) | A method, apparatus, server and readable storage medium for determining a back-to-source path | |
CN103731451B (en) | A kind of method and system that file uploads | |
WO2014067311A1 (en) | Resource subscription method and device | |
CN107925674A (en) | The method and apparatus of propelling data in the network (CCN) centered on content | |
CN108848025B (en) | Data processing method, intelligent gateway and Internet of things system | |
JP2016541048A (en) | Method, device and system for transferring data using service proxy | |
CN114598651B (en) | Data transmission method and device | |
CN103237024A (en) | Data conversion transmission method between TCP/IP (transmission control protocol/Internet protocol) and NDN (named data networking) protocol | |
WO2013078797A1 (en) | Network file transmission method and system | |
CN106302230B (en) | A kind of data transmission method and device | |
WO2013189394A2 (en) | Resource information acquisition method, system and device for internet of things terminal device | |
CN111669364B (en) | Data transmission method, device, electronic equipment and medium | |
CN108809549A (en) | A kind of method and apparatus of transmission data | |
JP6438110B2 (en) | Method and device for signaling in a communication network | |
CN107612831B (en) | A method and device for transmitting data message for accessing source station | |
WO2017040940A1 (en) | Improved block transfer operation in coap protocol | |
WO2017005118A1 (en) | Method, device, terminal and server for maintaining communication connection | |
CN111385069A (en) | Data transmission method and computer equipment | |
CN104618517B (en) | A kind of method, system and device of PUSH message | |
WO2010127591A1 (en) | Information synchronization implementation method and system based on synchronization standard protocol | |
CN109688204A (en) | Document down loading method, device based on NDN network, node, terminal | |
CN117793964A (en) | Core network data transmission method, electronic equipment and computer readable storage medium | |
CN118890389A (en) | An instant messaging method, server, client and system based on MQTT protocol |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |