07-22-2010 07:59 AM
Group,
I am working on an application that utilizes cellular modems. They have an IP address just like any Ethernet device, except the IP is a static IP on the Internet. It can be PINGED from the Cmd Line, just like any device.
However, the round trip on a ping may be 4-5 seconds, instead of milliseconds for a wired device, due to the complexity and speed of the cell network.
I use ConnectToTCPServer() to connect to my remote device, but use a long TCP_TIMEOUT (15-30 seconds) value to allow the modem to respond. This slows down the system, and no other events will be processed during this time. I have tried calling the ConnectToTCPServer() routine in a deferred callback, but same behavior.
To disconnect, I use DisconnectFromTCPServer(). This command responds very quickly, and I see the disconnect on the modem side.
Since cell modems periodically lose their connection, due to tower changes, etc, I have to reconnect on a 10-15 minute basis. When the modem loses connection, I do get the TCP_DISCONNECT callback, and respond accordingly.
Any suggestions would be appreciated.
Regards, David Eaton
07-22-2010 08:18 AM
How about having a separate thread to manage the connection/disconnection processes? That way if they take a long time it needn't tie up the rest of your application.
JR