[q2686] WIP 3.20.2030 crashes while being stopped

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:

  1. 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?

is you socket in modem a server socket that listens a tcp port or a client socket that connects to server? if you have to reconnect a client socket that shouldnt be difficult. just close the socket with wip_close function then follow the connecting procedure again. if it is server socket that you want to reconnect, then rigth u may have to restart wip stack,

I restart wip stack like this:
unsubscribing the uart1
// i dont wait for events for the following
wip_bearerclose
wipbeareropen
wipbearersetopts
wipbearerstart

My socket is a client socket. It is not difficult to close a client socket when it is opend, it is difficult to close it when it is waiting to connect.

To close the socket we use wip_abort and than wip_close. We do not use wip_shutdown at all.

Thank you for the reply! I’l try it.