I have Transparent Mode (AP=0) working to read sensor data over cellular from our server.
I need to use Auto-Start (PS=1) MicroPython to initiate the outgoing cellular TCP connection, and send keepalives keep it open.
The problem is that sensor data is one one port and keepalives end up on a different port.
On boot, MicroPython opens a socket to the server and uses it for the keepalives.
Sensor data on the UART is sent to the server (AP=0), but a second socket gets opened and the data ends up on a different port. Keepalives on the other port don’t keep the data socket open.
How can I get the MicroPython keepalaives on the same socket as the UART data?
MicroPython pseudo code:
SERVER_IP = ‘18.223.62.222’ # DL
SERVER_PORT = 88 # DE
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((SERVER_IP, SERVER_PORT))
s.setblocking(False)
(Keepalive time delay stuff here)
s.send(b’\x00’) # keepalive
Note: I am running: AP=0 Transparent Mode, PS=1 Python Auto Start
It is not going to use the same socket. Your best option is to use the TM and SO values on the module. These values are what are used to keep a socket open to the DL value.
Its TM and TS. TM is for the Client side timeout and TS is the server side timeout. What it is saying is that if there is NO traffic for TM or TS time, the socket is closed. it is not a keep alive but a timeout on the connection.
Ok, no keepalives for the Transparent Mode connection.
I do see complex keepalive support for the Remote Manager connection.
Is there a way to “trick” it into working on the Transparent Mode connection?
I’d like to submit a feature request for a VERY BASIC keepalive on the Transparent Mode socket.
Just send 1 byte. No retries, no resets, no ACKs, etc. Perhaps do a 1s check to make sure there is no incoming data.