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

NRF9160 Underlying Socket Behavior During Cellular Drops

Hello:

I am working on an application that uses a simple UDP socket for transmitting data.   I would like understand the zephyr BSD socket behavior when there are cellular connects/disconnects.

1.)   I my application I create a socket and then send data once a minute.      If I detect that the cellular connection has disconnected,  do I need to explicitly call close()  and then call  another open() and connect()?

In my current test firmware,  I noticed that sometimes a call to close() on an existing socket when there is no cellular connection will cause the NRF9160 to enter a weird state.    In my case, the zephyr shell thread kept working by the main thread which had the networking call appeared to be sleep/idle state forever after the close was called.

2.)  I created a simple test application where I could close() on an invalid/unused socket and could get the exact behavior from #1.    

For applications where I want to use UDP,  what is the correct order of operations when I detect a cellular connection is dropped?    I am trying to ensure that I can gracefully recover in this situation.

Related