Best practice setup for automatic and continuous connectivity?

So I dont have a good answer to the overall question but one thing I noticed with the SARA-R410M-02B modem is that you cannot query the state of a socket whether it is open, closed, listening, etc. For more information, see my question on the U-Blox forums (that didnt get a good answer) here: https://forum.u-blox.com/index.php/20159/control-command-working-documented-verify-socket-listening

For reference if you want the modem to be able to accept data / commands from the cloud it would need to setup a listening socket. This is true for cloud-> device messaging, revere SSH, and Spacebridge. What I am guess is happening is that Hologram’s SDK setup a listening socket but then for some reason it closes (sh*t happens, that’s ok) but there is there is no way to detect or poll for this state so neither Hologram’s SDK nor the users can easily react to a closed connection and re-open.

What would be great is if:

  1. U-Blox gave a URC whenever a listening socket is closed
  2. or 2nd best would be if there as an AT command to poll for listening sockets, atleast this wold allow the SDK or user to poll very often and make sure the connection is up or reset it if closed.

EDIT: I should have read my old post more closely. It looks like you can query socket state for TCP sockets with AT+USOCTL=<socket#>,10

So a possible solution is:

  1. periodically (like could be every 15s) run AT+USOCTL=<socket#>,10 and make sure socket is in a valid state (likely Listening, but could be one of the other TCP states if data transfer is active)
  2. if above is an invalid state, the module is not listening, close the <socket#> and re-configure as needed, something like AT+USOCR=6 then AT+USOLI=<socket#>,22 (protocol = TCP, listen on port = 22)
1 Like