After alot of investigration on different forums and revers engineering with Red Gate Reflector it is clear for me that there is a bug in the HttpListener in the NETMF 4.1
listener = new HttpListener(“http”, port);
context = listener.GetContext();
The get GetContext() hides a Socket, the Socket is not released on context.Close() because of the Linger. And the Socket is defined as private, so one cannot call the socket properties and add
Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Linger, -2);
Which will release the Socket on Close, say no Linger.
The HTTPListener therefor eats Sockets and stops when 128 Sockets is used.
The full framework has methods to deal with this - NETMF has not.
How to get this bug fixed?