5 years, 7 months ago.

Continuous updates

Hi, I am sending out regular position updates (once a second) to a server using the TCP example in your demo, do I have to close the socket and re-open it every time? It didn't work until I did this, but now it sometimes the socket won't open and I miss a number of samples.

I run this routine every time I get a valid GPS update:

socket = mdm.socketSocket(MDMParser::IPPROTO_TCP);

if (socket >= 0)


mdm.socketSetBlocking(socket, 10000);

if (mdm.socketConnect(socket, host, port))


ret = mdm.socketSend(socket, link, n);






but 'socket' returns -1 for a number of samples, so they don't get transmitted, then it starts working fine again.

Question relating to:

C027_Support library test C027, GNSS, GPRS, GPS, GSM, modem

1 Answer

4 years, 3 months ago.

You should be able to use socketSend multiple times without closing/reopening the socket. You may want to add error handling in case you are getting out of network coverage.

Accepted Answer