0

Can anyone help how to differentiate the incoming message structure of PUT and POST methods in CoAP protocol?

Or should we do some work in server c++ files ???

HariRHK
  • 11
  • 5
  • Everything related to the structure is here: https://tools.ietf.org/html/rfc7252. Your question seems incomplete. You've mentioned server and C++ but is it relevant for your question? – eugene-nikolaev Oct 05 '17 at 13:40
  • The Server C++ file mentioned here is that of CoAP library. We have a set of C++ file for CoAP Client and Server. – HariRHK Oct 09 '17 at 06:48

1 Answers1

0

Each CoAP message has a method code. It is 8 bit unsigned integer represented as x.yy where x is the 3 bit class and yy is 5 bit detail field.

You can use it to differentiate between PUT and POST.

Check out the RFC for the message format and the method code list.

For POST the code is 0.02 i.e. the byte is encoded as 0x02 while for PUT it is 0.03 so the byte is encoded as 0x03.

Community
  • 1
  • 1
yeniv
  • 1,589
  • 11
  • 25