Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 7 months ago.
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)
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:
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.