<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CoAP - Callback function</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/120618/coap---callback-function</link><description>Hello Nordic forum, 
 I must not quite understand how CoAP callbacks should work. Would anyone be able to give me any advice as to why my modified coap_client results in undefined behavior? In my main program, I&amp;#39;d call the function coap_send() at various</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 25 Apr 2025 13:42:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/120618/coap---callback-function" /><item><title>RE: CoAP - Callback function</title><link>https://devzone.nordicsemi.com/thread/533030?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2025 13:42:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfbb77f3-2b06-4f60-885f-419dd58be8ea</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hey, that&amp;#39;s excellent! Always good to solve the issue on your own. May I ask what the issue was?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CoAP - Callback function</title><link>https://devzone.nordicsemi.com/thread/532931?ContentTypeID=1</link><pubDate>Fri, 25 Apr 2025 03:36:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a322b64c-9abc-4e6b-a7ca-1a84a859ba2b</guid><dc:creator>Sage_Duggal</dc:creator><description>&lt;p&gt;Hello there, thank you for your reply. I actually figured this one out on my own. The problem was related to my poor understanding of C, but we&amp;#39;re getting better!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CoAP - Callback function</title><link>https://devzone.nordicsemi.com/thread/531380?ContentTypeID=1</link><pubDate>Thu, 10 Apr 2025 13:47:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:459e484f-7462-48d5-bcaa-7768d024d969</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello, I&amp;#39;ve been assigned your ticket and will look into this. Are you still using the slightly modified&amp;nbsp;coap_client sample as in&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/120503/errors-when-running-coap_client-sample-from-2-9-0-sdk"&gt;Errors when running coap_client sample from 2.9.0 SDK&lt;/a&gt;&amp;nbsp;?&lt;/p&gt;
&lt;p&gt;Could you please elaborate what changes you have done and with what configuration?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CoAP - Callback function</title><link>https://devzone.nordicsemi.com/thread/531265?ContentTypeID=1</link><pubDate>Thu, 10 Apr 2025 06:19:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c9b8326-7fe3-44d9-855e-7be640a82466</guid><dc:creator>Sage_Duggal</dc:creator><description>&lt;p&gt;Lastly, in my coap_client_req() function call, I&amp;#39;m passing NULL for the coap_transmission_parameters which should resolve as the CoAP default values. Looking at the RFC 7252 spec, the default ACK_TIMEOUT is 2 seconds which seems sufficient.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: CoAP - Callback function</title><link>https://devzone.nordicsemi.com/thread/531264?ContentTypeID=1</link><pubDate>Thu, 10 Apr 2025 06:16:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a63678e-4c0c-4245-8dbf-064d053ca742</guid><dc:creator>Sage_Duggal</dc:creator><description>&lt;p&gt;Here is sample output from when I run the program after it&amp;#39;s built using the debugging optimization. As you can see, the messages are sending, but only the first callback is received.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CoAP --&amp;gt; DEVICE ON.
[00:00:01.386,871] &amp;lt;inf&amp;gt; coap_client_sample: The CoAP client started.
[00:00:01.386,901] &amp;lt;inf&amp;gt; coap_client_sample: Bringing network interface up and connecting to the network
[00:00:02.720,336] &amp;lt;inf&amp;gt; coap_client_sample: Waiting for network connectivity
[00:00:05.857,421] &amp;lt;inf&amp;gt; coap_client_sample: Network connectivity established
[00:00:07.178,405] &amp;lt;inf&amp;gt; coap_client_sample: IPv4 Address found 10.60.10.132
[00:00:07.178,771] &amp;lt;inf&amp;gt; coap_client_sample: Socket created
[00:00:07.178,771] &amp;lt;inf&amp;gt; coap_client_sample: Initializing CoAP client
[00:00:07.180,786] &amp;lt;inf&amp;gt; coap_client_sample: CoAP POST request sent sent to coap.os.1nce.com
[00:00:07.180,816] &amp;lt;inf&amp;gt; coap_client_sample: Sent request, closing socket in 3 seconds
[00:00:07.484,283] &amp;lt;inf&amp;gt; coap_client_sample: CoAP response: code: 0x44, payload: 0 bytes
[00:00:10.181,182] &amp;lt;inf&amp;gt; coap_client_sample: periodic_coap_request_loop completed!
Exiting startup() in 2 seconds.

CoAP --&amp;gt; OK!
[00:00:33.185,394] &amp;lt;inf&amp;gt; coap_client_sample: The CoAP client started.
[00:00:33.185,424] &amp;lt;inf&amp;gt; coap_client_sample: Bringing network interface up and connecting to the network
[00:00:35.206,695] &amp;lt;inf&amp;gt; coap_client_sample: IPv4 Address found 10.60.10.132
[00:00:35.212,890] &amp;lt;inf&amp;gt; coap_client_sample: Socket created
[00:00:35.221,496] &amp;lt;inf&amp;gt; coap_client_sample: CoAP POST request sent sent to coap.os.1nce.com
[00:00:35.221,496] &amp;lt;inf&amp;gt; coap_client_sample: Sent request, closing socket in 3 seconds
[00:00:38.221,893] &amp;lt;inf&amp;gt; coap_client_sample: periodic_coap_request_loop completed!
Returning to the start of operate() in 3 seconds.

Entering operate()

CoAP --&amp;gt; OK!
[00:01:02.226,135] &amp;lt;inf&amp;gt; coap_client_sample: The CoAP client started.
[00:01:02.226,165] &amp;lt;inf&amp;gt; coap_client_sample: Bringing network interface up and connecting to the network
[00:01:04.238,739] &amp;lt;inf&amp;gt; coap_client_sample: IPv4 Address found 10.60.10.132
[00:01:04.244,934] &amp;lt;inf&amp;gt; coap_client_sample: Socket created
[00:01:04.253,540] &amp;lt;inf&amp;gt; coap_client_sample: CoAP POST request sent sent to coap.os.1nce.com
[00:01:04.253,540] &amp;lt;inf&amp;gt; coap_client_sample: Sent request, closing socket in 3 seconds
[00:01:07.253,936] &amp;lt;inf&amp;gt; coap_client_sample: periodic_coap_request_loop completed!
Returning to the start of operate() in 3 seconds.&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>