From: Kovatsch M. <kov...@in...> - 2013-09-04 09:19:16
|
You can use the global coap_error_code as a hook just like coap-separate does. Set it to MANUAL_RESPONSE in your resource handler and no response or empty ACK will be sent. coap_error_code = MANUAL_RESPONSE; The engine will also close the transaction associated to the current request. Ciao Matthias Von: Gruber, Lorenz [mailto:lor...@im...] Gesendet: Montag, 2. September 2013 17:33 An: con...@li... Betreff: [Contiki-developers] er-coap-13 -- code error for CoAP - NON requests? Hello, I sending a CoAP GET request to a Erbium CoAP server. However I don't want to get an ACK nor a response back from the CoAP server. As I am using IPv6 multicast addresses to spread the CoAP GET inside the network, all the ACK/ responses increase the network traffic which is undesirable. To my understanding of CoAP 13, when I use a NON request, no ACK is sent. HOWEVER: the response of my GET request is still sent and I receive a 2.05 back from the server even if I set the payload inside the resource to zero. So CoAP 13 for NON requests does not give the option to send nothing, but always automatically initiates a CoAP NON response. The following code snippet below is from "er-coap-13-engine.c" inside the "coap_receive()" function shows what is done depending on the COAP_TYPE. if (message->type==COAP_TYPE_CON) { /* Reliable CON requests are answered with an ACK. */ coap_init_message(response, COAP_TYPE_ACK, CONTENT_2_05, message->mid); } else { /* Unreliable NON requests are answered with a NON as well. */ coap_init_message(response, COAP_TYPE_NON, CONTENT_2_05, coap_get_mid()); // -> but what if I don't want so send back anything?? // hack by me to solve the problem, but rather ugly coap_error_code=MANUAL_RESPONSE; } Question: - Is there another way to prevent that nothing is sent back for a CoAP GET? (apart from my solution indicated in the code snippet above) - Ideally one would have the choice inside the CoAP resource handle to decide whether to send a response or not. Thank you very much, Lorenz |