Hello, I’m developing an app. that monitores GPS and sends the data to a server via GPRS/TCPIP/socket.
The module is q2686h, firmware 663g00_full_q2686h.dwl , OpenAT 4.29.
The app. tries to keep socket to the server opened at all times. If the socket is closed by server or GPRS provider the app. reconnects the socket. Some times the socket is waiting for connection forever and no events ever arrive to the socket handler function. I watch out for this and after 5 min. of waiting I want to close the socket and try to reconnect. But a waiting socket can’t be closed, so i have to resart WIP stack.
Jast calling wip_netExit() crashes the app.
WIP documentation says the correct sequence is like this:
- wip_shutdown(socketHandle, TRUE, TRUE); to close all sockets
WIP_CEV_PEER_CLOSE arrives to socket handler for opened sockets, but not for the waiting socket.
2)wip_bearerStop()
3)wait for WIP_BEV_STOPPED in WIP bearer handler function.
This event never arrives, so I just wait 3 sec. and go to next step.
4)wip_bearerClose()
5)wip_netExit() to stop WIP and clear all resources
All steps are run from a timer handler, so controll is returned to the OS after each step.
The app. often crashes after wip_bearerStop().
So the question is how do I restart WIP when there is a waiting socket, or kill the socket?