CoAP数据包的大小是多少? [英] What is the size of CoAP packet?

查看:1116
本文介绍了CoAP数据包的大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是这项技术的新手,有人可以帮助我了解一些疑问吗?

I'm new for this technology, can somebody help me to know about some doubt?

Q-1. CoAP封包的大小是多少?
(我知道有4个字节的固定标头,但是包括标头,选项和有效载荷的最大大小限制是多少?)

Q-1. What is the size of CoAP packet?
(I know there is 4 byte fixed header, but what is the maximum size limit including header, option and payload?)

问题2.有像MQTT这样的Keep Alive概念吗?
(它可以在UDP上保持打开连接的时间,是否有默认时间,或者在每次发送数据包时保持打开状态?)

Q-2. Is there any concept for Keep Alive like MQTT?
(It works on UDP for how much time it keeps open the connection, is there any default time or it keeps open every time when we send packet?)

问题3.我们可以将CoAP与TCP一起使用吗?
(CoAP的主要问题是它可以在UDP上工作,是否有像MQTT QoS这样的概念?假设传感器每隔一秒钟发布一些数据,如果用户下线,CoAP中是否有任何保证,当用户下线时,CoAP会获取所有数据它上网吗?)

Q-3. Can we use CoAP with TCP?
(Main problem with it CoAP is it works on UDP, is there any concept like MQTT QoS? Let's say a sensor publishes some data every one second, if subscriber goes offline, is there any surety in CoAP that subscriber will get all the data when it come online?)

问题4.连接的持续时间是多长?
(CoAP支持发布/订阅体系结构,可能是一直需要打开连接,是否可能与CoAP基于UDP.)

Q-4. What is the duration of connection?
(CoAP supports publish/subscribe architecture, may be it needs connection open all the time, is it possible with CoAP whether it is based on UDP.)

问题5.它是如何发现资源的?
(我有一个网关和5个传感器,这些传感器将如何连接到网关?网关会找到这些传感器吗?还是传感器会找到网关?)

Q-5. How does it discover the resources?
(I have one gateway and 5 sensors, how will these sensors connect to the gateway? Will the gateway find these sensors? Or will sensors find the gateway?)

问题5.传感器如何向网关注册?

请帮助我,我真的需要回答.对于这些事情,我是新手,并建议我从实现的角度来看.

Please help me, I really need answer. I'm all new for these kind of things and suggest me something for implementation point of view.

谢谢.

推荐答案

  1. 取决于:
    • 核心CoAP消息必须足够小以适合它们的链路层数据包(UDP约为64 KiB),但无论如何,RFC指出:
      • 应该将其放入单个IP数据包中,以避免IP碎片(IPv6的MTU为1280).如果对报头的大小一无所知,则好的上限是消息大小为1152字节,有效负载大小为1024字节;
      • 或更少以避免适应层碎片化(对于6LoWPAN网络为60-80字节);
  1. It Depends:
    • Core CoAP messages must be small enough to fit into their link-layer packets (~ 64 KiB for UDP) but, in any case the RFC states that:
      • it SHOULD fit within a single IP packet to avoid IP fragmentation (MTU of 1280 for IPv6). If nothing is known about the size of the headers, good upper bounds are 1152 bytes for the message size and 1024 bytes for the payload size;
      • or less to avoid adaptation layer fragmentation (60-80 bytes for 6LoWPAN networks);

我从未使用过MQTT,无论如何CoAP是无连接的,请求和响应都是通过UDP或DTLS异步交换的.我想您正在寻找观察功能:它使CoAP客户端可以订阅"资源和服务器,以便在一段时间内向订阅的客户端发送更新.

I never used MQTT, in any case CoAP is connectionless, requests and responses are exchanged asynchronously over UDP or DTLS. I suppose that you are looking for the observe functionality: it enables CoAP clients to "subscribe" to resources and servers to send updates to subscribed clients over a period of time.

有一个 IETF草案描述基于TCP的CoAP,但我不知道它如何与观察功能交互:通常遵循,恰好发生了,客户端被视为对资源不再感兴趣,并被服务器从观察者列表中删除了.

There is an IETF draft describing CoAP over TCP, but I don't know how it interacts with the observe functionality: usually It follows a best-effort approach, it just happens that the client is considered no longer interested in the resource and is removed by the server from the list of observers.

当服务器认为客户端不再对资源感兴趣或客户端要求退订资源时,观察停止.

The observe stops when the server thinks that the client is no longer interested in the resource or when the client ask to unsubscribe from the resource.

有一个众所周知的相对URI"/.well-known/core".它被定义为用于请求有关服务器托管资源的链接列表的默认入口点. 此处以获取更多信息.

There is a well-known relative URI "/.well-known/core". It is defined as a default entry point for requesting the list of links about resources hosted by a server. Here for more infos.

查看5.

这篇关于CoAP数据包的大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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