What is the size of CoAP packet

0 votes

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

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?)

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?)

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?)

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.)

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?)

Q-5. How does sensor register with gateway?

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.


Jul 17, 2018 in IoT (Internet of Things) by Matt
• 2,270 points

1 answer to this question.

0 votes
  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);
    • if you need to transfer larger payloads, this IETF draft extends core CoAP with new options for transferring multiple blocks of information from a resource representation in multiple request-response pair (so you can transfer more than 64KiB per message).
  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. Look at 5.

answered Jul 17, 2018 by anonymous2
• 4,280 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

What is the time taken by a 200 byte message for transmission in a beacon-enabled network?

Now, data rates of IEEE 802.15.4 are ...READ MORE

answered Aug 24, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
0 votes
1 answer
0 votes
1 answer

What is the difference between IoTivity vs AllJoyn ?

Architecture: IoTivity provides 4 basic components: Discovery Data transmission Data Management Device ...READ MORE

answered Sep 6, 2018 in IoT (Internet of Things) by Annie97
0 votes
1 answer

What is the Best practice to create automatic reports with Cumulocity?

There is a new feature regarding reporting ...READ MORE

answered Nov 23, 2018 in IoT (Internet of Things) by Shubham
• 13,490 points
0 votes
1 answer
0 votes
1 answer

Downloading source code of Android Things

No because AndroidThings is still in preview ...READ MORE

answered Jul 5, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
0 votes
1 answer

Setting-up a RFID RC522 chip in Raspberry Pi?

First, let me congratulate you on buying ...READ MORE

answered Jul 10, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
0 votes
1 answer

What is the maximum message length for a MQTT broker?

It's not entirely clear what you're asking ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
0 votes
1 answer

What is the best way to retrofit existing alarm PIR with esp8266/etc?

Here is an explanation that best fits ...READ MORE

answered Sep 4, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP