<?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>Is it possible to fix the client&amp;#39;s LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105718/is-it-possible-to-fix-the-client-s-lwm2m-port-on-the-nrf9160</link><description>sdk v1.9.1 (in the process of moving to v2.05) 
 nRF9160 modem v1.3.1 
 Hi, 
 I have been using the lwm2m library on the nRF9160 successfully to connect to a LWM2M server (Leshan or Coyote). 
 Now I have a client that has its own LWM2M server but requires</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 21 Nov 2023 16:27:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105718/is-it-possible-to-fix-the-client-s-lwm2m-port-on-the-nrf9160" /><item><title>RE: Is it possible to fix the client's LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/thread/456755?ContentTypeID=1</link><pubDate>Tue, 21 Nov 2023 16:27:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d47fcc52-9c41-4604-a260-2eb045cf1bbd</guid><dc:creator>RicardoCarvalho</dc:creator><description>&lt;p&gt;Hi Achim,&lt;/p&gt;
&lt;p&gt;Anyway thanks for the help!&lt;/p&gt;
&lt;p&gt;I think the best option would be to change the server to a more &amp;#39;standard&amp;#39; operation instead of having to make changes to the SDK.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Ricardo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to fix the client's LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/thread/456239?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 19:06:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8050f4c-da1d-4c88-b990-3978e299479e</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;I don&amp;#39;t use the approach with bind() so I don&amp;#39;t have the details by hand. But you will find a lot of examples searching the web.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to fix the client's LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/thread/456236?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 18:39:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f86d8c1-7f73-443b-b562-f367bdb5bcbc</guid><dc:creator>RicardoCarvalho</dc:creator><description>&lt;p&gt;Hi Achim,&lt;/p&gt;
&lt;p&gt;Thanks for the detailed explanation!&lt;/p&gt;
&lt;p&gt;I thought it would be a matter of settings, the last thing I wanted was to change the SDK&amp;#39;s lwm2m library &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f61f.svg" title="Worried"&gt;&amp;#x1f61f;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regarding bind(), I thought it was only used on the server...&lt;br /&gt;How is it used on the client?&lt;br /&gt;I assume it will be before connect(), but what is the sockaddr passed in bind()?&lt;br /&gt;Is it the &amp;quot;(client IP):(port I want)&amp;quot;?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your help!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Ricardo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to fix the client's LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/thread/456170?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 13:13:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:348b7544-c17f-4900-8a6a-7d89993e4830</guid><dc:creator>Achim Kraus</dc:creator><description>&lt;p&gt;Hi Ricardo,&lt;/p&gt;
&lt;p&gt;the answer has unfortunately two parts:&lt;/p&gt;
&lt;p&gt;1. (the good one): you may chose a local port by using &amp;quot;bind()&amp;quot;.&lt;/p&gt;
&lt;p&gt;2. the port your server gets in the received packet may still be a different one.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t tested 1, because in my experience, the 2. makes it unattractive.&lt;/p&gt;
&lt;p&gt;The 2. is mainly caused by the network infrastructure, e.g. a IP-breakout of your network provider, which then acts a NAT (network address translator). Such network components usually assign your cellular device a temporary public IP-address. Without traffic for a while, that assignment is cleared and may be reused by other devices.&lt;/p&gt;
&lt;p&gt;So, which local ip-address does your device report? And which device ip-address does your server&amp;nbsp; report? You may also ask your mobile network provider, what&amp;#39;s used there. Some are offering so called &amp;quot;private networks&amp;quot;, which then requires a &amp;quot;ip-tunnel&amp;quot; in order to connect you server to that &amp;quot;private network&amp;quot;.&lt;/p&gt;
&lt;p&gt;If you use DTLS 1.2, then DTLS 1.2 CID may offer you an alternative solution. The LwM2M server must support that as well, because for LwM2M it&amp;#39;s not only the DTLS layer, which needs to consider the client&amp;#39;s ip-address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to fix the client's LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/thread/456139?ContentTypeID=1</link><pubDate>Fri, 17 Nov 2023 11:40:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78483276-b51c-422d-86d1-c45f9feff67a</guid><dc:creator>RicardoCarvalho</dc:creator><description>&lt;p&gt;Hello Amanda,&lt;/p&gt;
&lt;p&gt;Maybe I didn&amp;#39;t make myself understood... I need to define the port of the client (device) not the server. The port that the server uses to talk to the client.&lt;/p&gt;
&lt;p&gt;When the LWM2M client makes a registration request to the server, it indicates the port that the server will have to use to talk to this client, it is this port that I wanted to know if it can be defined.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your help!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Ricardo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is it possible to fix the client's LWM2M port on the nRF9160?</title><link>https://devzone.nordicsemi.com/thread/456012?ContentTypeID=1</link><pubDate>Thu, 16 Nov 2023 14:39:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a8283c3-ce7b-4f8a-b775-f43751bc04f8</guid><dc:creator>Amanda Hsieh</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can set the fix port with&amp;nbsp;&lt;span&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index.html#CONFIG_LWM2M_CLIENT_UTILS_SERVER"&gt;CONFIG_LWM2M_CLIENT_UTILS_SERVER&lt;/a&gt;:&lt;br /&gt;&lt;em&gt;Choose the LwM2M server you wish to connect to. Address must be full URI containing protocol and port numbers, unless it is same as CONFIG_LWM2M_PEER_PORT. For example &amp;quot;coaps://server.example.com:5684&amp;quot;. Protocol must be &amp;quot;coap&amp;quot; when no security is used, or &amp;quot;coaps&amp;quot; when DTLS is used.&amp;nbsp;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Example:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v2.5.0/samples/cellular/lwm2m_client/prj.conf#L91"&gt;https://github.com/nrfconnect/sdk-nrf/blob/v2.5.0/samples/cellular/lwm2m_client/prj.conf#L91&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Amanda H.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>