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

No message received at UDP server for UDP_with_PSM sample

Hi,

I'm working in NB IoT (AT%XSYSTEMMODE=0,1,0,0), trying to communicate with our private UDP server using the UDP_with_PSM sample. After configuring the main.c file (changed #define HOST "ntp.uio.no" to #define HOST "192.168.2.1" i.e. the IP of our server) and the prj.conf file (added CONFIG_LTE_NETWORK_MODE_NBIOT=y and CONFIG_LTE_NETWORK_MODE_LTE_M=n), I flashed it on to my nRF9160DK. However, even after connecting with our server (AT+CGDCONT shows that the DK has connected to the server IP), no data is received by the server. 

Any ideas what might be causing this problem and how can I work around it?

Best Regards,

Shahmeer.

  • I don't know much about routing and IP addresses, but I talked to a colleague and got some insight. I think your problem is that you are using the private IP address (192.168.2.1), which can only be accessed by devices belonging to the same local network. Read this article for more insight about Class C networks (ranging from 192.168.0.0 – 192.168.255.255).

    The solution is to send the message to the router, and route it from there to the computer hosting the server. I am not sure how this is done, but can look into it if you would like to.

    Best regards,

    Simon

  • Hi Simon,

    Are you suggesting that I should set the HOST to a publicly available UDP server and reroute the sent packet back to our private server? If yes, then I honestly don't know how to accomplish the latter part of the problem. As such, any help or insight would be highly appreciated.

    Regards,

    Shahmeer.

    P.S. Thanks for the link to the article about Class C networks; it was an interesting read.

  • Should be a case of port forwarding.

    You will need to find the external IP address of your local network, any "what's my IP" website can get that for you. Then you will need to go into the router settings and set up a forwarding call to reroute incoming data on the external IP to an internal IP.

    This can be done by setting up a port forwarding call, any incoming data to the external IP with a port number you define (i.e. on port 12345), the router will redirect the incoming data to the internal IP (i.e. your UDP server).

    Once the port forwarding on your router has been set up, you just need to have the device connect to your external IP and the port you specified.

Related