I’m trying to use the async functions for Ethernet and have created a test program:
The code for the local display can be removed, output is also on stdout.
- Bringing the EthIF up or down by plugging / unplugging the network cable
- Bringing the EthIF up or down by calling connect / disconnect
- on status change, a TCP socket server is started / stopped
- connecting with telnet to the socket an receive a hello message
- after connecting with telnet, a down/up sequence and stop/start server fails with error -3003 (invalid param) on server socket listen().
- after 120 s, stopping / starting the server works again
The error on listen may happen already on bind(), listen complains at a point where no port is assigned. It looks like the server port is locked for 120 s, this may be by a recommendation that sockets should not be reused for some time?
I guess that it is a Mbed or LwIP bug, what can be the problem?
Output for working case:
EthIF disconnected sockServer state changed server stopped EthIF connecting EthIF global up my IP is: 192.168.100.36 server started
non working case:
EthIF disconnected sockServer state changed server stopped EthIF connecting EthIF global up my IP is: 192.168.100.36 sockServer listen error: -3003 server started