<?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>Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84191/cloud-coap-client-tcp-issues</link><description>I&amp;#39;m building a COAP client using the Nordic nRF9160DK cloud coap-client example code as my base. I have the UDP version working great. But I&amp;#39;d like to convert to TCP.. I was hoping it would be a simple change to the socket just the addrinfo and socket</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 29 Jan 2022 14:38:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84191/cloud-coap-client-tcp-issues" /><item><title>RE: Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/thread/350313?ContentTypeID=1</link><pubDate>Sat, 29 Jan 2022 14:38:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:957caaae-85d5-4f94-ad7e-31721386668f</guid><dc:creator>KCrawford</dc:creator><description>&lt;p&gt;Thanks for your excellent response. I agree with your observation of the data-rate we are trying to achieve. But time will tell. We have tested successfully at much higher rates (in excess of 3Kbytes per sec) to our server. So that seemed like good news. But perhaps the conditions were ideal. Time will tell. I guess we can go ahead a close this ticket.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/thread/350312?ContentTypeID=1</link><pubDate>Sat, 29 Jan 2022 14:11:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f05746c-fcf9-4432-bc86-7449b7b63625</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;Generally, I&amp;#39;m not sure, if operating a CAT-M1/CAT-NB modem at 1k/s is a good idea. That depends on your SIM card contract and battery size. And I guess, it only works for CAT-M1.&lt;/p&gt;
&lt;p&gt;If RFC8323 is not supported, you can&amp;#39;t use that standard for CoAP over TCP. You may try to fiddle it your own way (e.g. prepend the length ahead with 2 bytes and decode them when reading), but I&amp;#39;m not sure, if that is good idea.&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s just the payload size, there are two ways to go:&lt;/p&gt;
&lt;p&gt;- RFC7959 or&lt;/p&gt;
&lt;p&gt;- send the data in smaller packages little more frequently. If your server is fast enough, you may use NSTART-2 (means you may have two requests in flight), though RTT is in CAT-NB not that fast. (Maybe CAT-NB isn&amp;#39;t fast enough at all.)&lt;/p&gt;
&lt;p&gt;Finally, even though I&amp;#39;m a real fan of CoAP,I&amp;#39;m not sure, if other protocols would fit better.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/thread/350307?ContentTypeID=1</link><pubDate>Sat, 29 Jan 2022 10:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b1a775a-59cc-4795-8f73-bf2e2a660dc2</guid><dc:creator>KCrawford</dc:creator><description>&lt;p&gt;This is my first COAP project, so not a lot of experience. The reason we would like to use TCP is primarily due to payload size. We have multiple sensors sampling at 200HZ.And we transmit at 2HZ. And the payload size is about 1730 bytes. Apparently, that is too large for Zephyr&amp;#39;s UDP implementation. But we overcame that issue with LZ4 compression. So we were hoping switch to TCP would give us some size and speed advantages. And we do have a server that supports TCP/TLS.&lt;/p&gt;
&lt;p&gt;So I&amp;#39;m seeing Zephyr&amp;#39;s COAP Lib only supports these RFC. I guess that mean Zephyr doesn&amp;#39;t support COAP/TCP?&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;
&lt;p&gt;&lt;a class="reference external" href="https://tools.ietf.org/html/rfc7252"&gt;RFC7252: The Constrained Application Protocol (CoAP)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a class="reference external" href="https://tools.ietf.org/html/rfc6690"&gt;RFC6690: Constrained RESTful Environments (CoRE) Link Format&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a class="reference external" href="https://tools.ietf.org/html/rfc7959"&gt;RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a class="reference external" href="https://tools.ietf.org/html/rfc7641"&gt;RFC7641: Observing Resources in the Constrained Application Protocol (CoAP)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/thread/350302?ContentTypeID=1</link><pubDate>Sat, 29 Jan 2022 07:05:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8a97fb0-ef2a-49e9-803e-49d10894f6ce</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;Using CoAP over UDP is specified in&amp;nbsp;&lt;a href="https://datatracker.ietf.org/doc/html/rfc7252"&gt;RFC 7252&lt;/a&gt;, CoAP over TCP in&amp;nbsp;&lt;a href="https://datatracker.ietf.org/doc/html/rfc8323"&gt;RFC 8323&lt;/a&gt;. It uses different message formats (e.g removed MID, though the transmission is left to TCP, added length, which must be handled above TCP).&lt;/p&gt;
&lt;p&gt;AFAIK, &lt;a href="https://github.com/obgm/libcoap"&gt;libcoap&lt;/a&gt; offers a up-to-date implementation. If you want to test CoAP over TCP you will also require a server. &lt;a href="https://github.com/eclipse/californium"&gt;eclipse/californium&lt;/a&gt; only offers a experimental implementation, which was never updated according the final RFC 8323. So that sandbox will hardly work, you need an other one.&lt;/p&gt;
&lt;p&gt;May I ask, why you try to use CoAP over TCP?&lt;/p&gt;
&lt;p&gt;In too many cases you lose the advantages of CoAP (less ip-messages, very efficient, very reliable, and with DTLS CID (upcoming &lt;a href="https://www.rfc-editor.org/rfc/authors/rfc9146.html"&gt;RFC 9146&lt;/a&gt; ) all that with true e2e security.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/thread/350276?ContentTypeID=1</link><pubDate>Fri, 28 Jan 2022 16:40:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:709645fe-ea74-47fd-b6e5-e3387752bba9</guid><dc:creator>KCrawford</dc:creator><description>&lt;p&gt;Well, for some reason, I can&amp;#39;t drag-n-drop the screenshots here. So I&amp;#39;ll just paste the code. Ugh!&lt;/p&gt;
&lt;p&gt;int err;&lt;br /&gt; struct addrinfo *result;&lt;br /&gt; struct addrinfo hints = {&lt;br /&gt; .ai_family = AF_INET,&lt;br /&gt;#ifdef USE_UDP&lt;br /&gt; .ai_socktype = SOCK_DGRAM&lt;/p&gt;
&lt;p&gt;#else&lt;br /&gt; .ai_socktype = SOCK_STREAM &lt;br /&gt;#endif&lt;/p&gt;
&lt;p&gt;-------&lt;/p&gt;
&lt;p&gt;static int client_init(void)&lt;br /&gt;{&lt;br /&gt; int err;&lt;/p&gt;
&lt;p&gt;#ifdef USE_UDP&lt;br /&gt; sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);&lt;br /&gt;#else&lt;br /&gt; sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);&lt;br /&gt;#endif&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Cloud COAP-Client TCP Issues</title><link>https://devzone.nordicsemi.com/thread/350275?ContentTypeID=1</link><pubDate>Fri, 28 Jan 2022 16:33:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97923d3c-295b-4ebf-9f83-7a92d1ea6483</guid><dc:creator>KCrawford</dc:creator><description>&lt;p&gt;Here are some screenshot of how I configure the sockets and the logging out. BTW, I&amp;#39;m using SDK 1.7.1 and Segger&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>