This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

CoAP, CoAPS and UDP

Hi,

I use example projects  Thread: CoAP Client and  Thread: CoAP Server . I can send and receive data over CoAP. My purpose is to use CoAP, CoAPS and UDP tohether. If client send UDP message, server can reply with UDP payload or client send CoAPs, server reply same manner. How can I accomplish to send CoAPs and UDP data?

Parents
  • I'm not sure, what you exactly mean. Let me try to explain, how coap and coaps is handled in scenarios I know. coaps uses dtls the create encrypted coap-message as udp messages, while coap send the coap-message unencrypted directly over udp. This includes, that the client uses different "coap-endpoint", setup to sent the coap-message direct or encrpyted. Such a client-coap-endpoint is bound to a local port. The results in two coap-endpoints with different ports on the client. The server usually does the same, it offers on 5683 plain coap and on 5684 coaps (coap-dtls-udp). Some implementations (e.g. Eclipse/Californium) offer a (client-side) endpoint manager for that. Once setup, the client may just use either coap or coaps as scheme and the the coap-client will do the magic for you.

    So in short: use different coap-endpoints with different ports and different configurations.

  • Thanks, but it is not my question. 

    My question is that: How can I modify  Thread: CoAP Client and  Thread: CoAP Server examples? There is no written code such as coaps.c or udp.c.  I can just use coap codes. I can send and receive message with just by using CoAP.

    There is a constant for secure

    #define OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 0

    I must set it to 1 but after that ? How to modify code? What is the simplest way? Some codes are written in C++. But I just know C.

Reply Children
No Data
Related