Hardfault error mbed

Hello,

I’m sorry I didn’t have much time.

Here you can found what it can be override in mbed_app.json for LWIP.
It seems you need to set socket-max according to sum of :

  • 2 for UDP
  • 1 TCP for server - maybe, I am not sure
  • X for TCP clients
  • +1 for Internal for DNS how is written in the help of “socket-max”

So maybe you need something like this

{
    "target_overrides": {
        "*": {
            "platform.stdio-convert-newlines": true,
            "target.network-default-interface-type": "ETHERNET",
            "lwip.socket-max": 8,
            "lwip.tcp-socket-max": 6,
            "lwip.udp-socket-max":2
        }
    }
}

From what I tested it seems, it will crash every time when you reach max socket -1.

For the rest of code. Maybe decrease the delay time in TCP server thread to something smaller like 100ms. Because you want to process clients as soon as possible and not wanting 1s between every one.

BR, Jan