...which gives WTP a lot of open but defunct sockets that cannot be used by the OS.
The code is full of resource leaks, notable gWTPSocket is not freed before overwrite.
The close-net functions calls 'shutdowns, but passes the arguments in the wrong order.
I've got a few more bugs, notably shrinking the stack size for pthreads so it doesn't take up 8MB per thread (it is not nice on an embedded device and very notable).