Mongoose sockets not closing


I’m using Mongoose Networking library.
I have a webserver (with mongoose library) , and I want to send it messages using HTTP.
The problem is that the server gets a lot of connections fast.

Im using MG_F_CLOSE_IMMEDIATELY in the client when I connect, and I use MG_F_SEND_AND_CLOSE on the server when the connection is received.

Anyway, it gets to thousands of socket connections fast (with only 1 client), in ESTABLISHED and in TIME_WAIT.

Is there a way to prevent this?
Can I reuse the socket?


Apparently, that works as intended.