ghi-electronics / TinyCLR-Libraries

Official Libraries supporting TinyCLR OS
https://www.ghielectronics.com/tinyclr/
17 stars 16 forks source link

HttpListenerContext GetContext only call 31 times, starting 32th failed when external memory enable. #1346

Closed Palomino34 closed 4 months ago

Palomino34 commented 4 months ago

Maximum socket is 32 at the same time. Call GC to close unused socket.

Palomino34 commented 4 months ago

Starting 2.2.2.1000, GHI added Socket.SocketInUsed property, whenever this value reach to max, call GC.

         if (Socket.SocketInUsed >=31)
         {
             System.GC.Collect();
             System.GC.WaitForPendingFinalizers();
         }