Home > Blockchain >  Is it possible to limit the number of tls sockets created (Android) when connecting to ESP32 https s
Is it possible to limit the number of tls sockets created (Android) when connecting to ESP32 https s

Time:12-10

We have the following setup:

  • ESP32 starts a https server, with the limitation of 6 concurrent TCP socket connections
  • A Xamarin App running on Android using javax.net.ssl as the TLS client

The observation is, that the App opens 6 sockets. Unfortunately we have memory limitations on the ESP32. About 160kb of heap is available and for each socket we need roughly 30kb for each SSL session context. Is it possible to limit the number of sockets created by the Android tls client?

To clarify, the app is delivered by a supplier. For the communication the xamarin httpclient is used, which does not provide low level access to the sockets. Observing the network communication with wireshark it shows that the Client automatically used between 4-6 socket connects. This seems to be in line with the http protocol, to speed up the page loads. see for example

https://www.oreilly.com/library/view/http-the-definitive/1565925092/ch04s04.html

CodePudding user response:

Leaving this here in case someone else stumbles upon a similar requirement "to limit number of connections".

The HttpClientHandler has a Property MaxConnectionsPerServer, which sets a connection Limit per Endpoint.

The full documentation can be found dotnet-maxconnections

  • Related