running out of socket

Hello,

I am using NET OS 7.4.
I’ve got an application that open a socket, listen if any message has been received on this socket, send a message from this socket, and then close the socket. This is done in a loop.
It is working fine for a while, but it become not possible to connect to the unit anymore. It seems my application is running out of socket.
Checking the socket with SNMP, I can see a lot of them are in a state different than listening. They should have been closed but they still in state such as waiting, FIN, …

Does somebody knows if the function closesocket(s) has some problems closing (for good) the socket? And how to resolve this?

Thanks

Seb

Hi Seb,

In NETOS it takes a certain period of time for the memory of a closed socket to be freed up. Don’t quote me but I want to say something between 1-4 minutes.

Keith

Maximum Segment Life (MSL) is a timer in a TCP stack to determine how long to allow a tcp socket to stay in a time wait state after a close. The standard is 2 minutes. SO by default, after you close a TCP socket, its resources will not be returned to the stack (will not be available for reuse) for 2 minutes. You can reduce MSL by calling the API NAIpSetTcpMsl. I believe the parameter is seconds. The API is described in the API reference manual. This call is global. Thus you want to call it before you start opening sockets. All sockets opened/closed AFTER calling this API wil be affected by the change in MSL.