Wip_close, ..shutdown, ...abort -> release resources problem



My application uses TCP client sockets and FTP. After some time (depending on WIP_NET_OPT_SOCK_MAX parametr) I’m running out of free sockets.

Returned errors are:

Trace CUS4 1 ERRLOG ch_tcp_client.c:751: No more IP buffers available
Trace CUS4 1 ERRLOG ch_tcp_client.c:752: returned WIP_CERR_RESOURCES


Trace CUS4 1 ERRLOG ch_tcp_client.c:107: No more free socket

I’ve tried: wip_close( handle), wip_shutdown (handle, FALSE, TRUE) and wip_close(handle) in WIP_PEER_CLOSE event hadler, wip_shutdown (handle, TRUE, TRUE) and wip_close(handle) in WIP_PEER_CLOSE event hadler, wip_abort( handle ).

Resources leakage exist even if every of the API’s above returns OK.

This happens on OpenAT 4.24d and earlier ones. I’m using Q2686H and Fastrack Supreme 20.

Is there any way to recover used resources in a reasonable amount of time other then dropping GPRS connection?
Is there a way to see how many sockets are actually being used?
Should I farther review my code or is it a known problem with WIP?




I get the same problem with FW 6.63 and OAT 4.24 and earlier. The only workaround that has worked so far was to exit the WIP stack (when internet connection was not needed) and to initialize it again. I would say that in many respects WIP is still in beta stage, unless we, the users, are too stupid to use it correctly, but then you could always say that the WIP documentation is in pre-alpha stage.

I suggest WIP and OpenAT become open source projects, it would dramatically increase stability and time to market and even be more profitable for wavecom.

Best regards,



You don’t release the resources take by the socket.
One probable reason may be the case where you create socket and try to connect to the server.
If this fails (will get event WIP_CEV_ERROR) you have to release the resources taken by the socket with wip_close.

Best regards,



It’s not the case. I have wip_close(ev->channel) in every WIP_CEV_ERROR handler. As I mentioned before: wip_TCPClientCreate(), wip_FTPCreate() and wip_getFile() return positive handlers. Also wip_close() returns OK. I haven’t tested it very extensively yet, but it seems to work much better on OASiS 2.0 beta 9. There seems to be some kind of timeout implemented for recovering closed sockets resources because if I open and close sockets slow enough I never run out of sockets. Of course the highier WIP_NET_OPT_SOCK_MAX the quicker opening and closing rate is possible.



Do you close on WIP_CEV_PEER_CLOSE events also?


Yes, I do.

I noticed, on default after every 8 opened and closed sockets the 9th can’t be established till the 1st one is timed out - (one minute since wip_close() )

This is done on Fastrack Supreme 20 with FW 6.63b10 and , OpenAT 4.24d.

This one minute timeout is not a problem as you can increase the maximum number of sockets, but maybe I’m doing something wrong.