cancel
Showing results for 
Search instead for 
Did you mean: 

I created a code for STM32H743ZI lwip RTOS socket server that can connect multiple clients ,I've an issue in binding of server to socket after terminating and recreating the server thread when ethernet cable is removed and reconnected.

PREDATOR
Associate II

Termination of server thread and closing the connection is done in the disconnection of ethernet cable and the thread is recreated when ethernet cable is reconnected, the accepted clients run in separate threads. I am also terminating client handle treads and closing connection of clients when the ethernet cable is removed . the client handling threads are created from the main server thread when a successful accept is happened in server.

  1. When only server thread is active, when ethernet cable is removed the thread is terminated and connection is closed ,The server thread is recreated when the ethernet cable is reconnected and the binding of server to socket is successful.
  2. When server thread and client handle threads are active ,When ethernet cable is removed the client handle threads and server thread is terminated and closed all the client connections and server connection , When the ethernet cable is reconnected the server thread is recreated ,But the binding of server to socket is not happening

Why binding of server to socket is not happening in case 2 ?

1 REPLY 1
Piranha
Chief II

You don't have to terminate the server thread and client connections on link disconnection. If the link is restored after a short time, you want the TCP connections to continue to work. They will die off and with timeouts will be closed when the appropriate time will come. Application code doesn't have to deal with link layer code and vice versa.

Anyway, if you are using HAL/Cube code, then the real problem is this:

https://community.st.com/s/question/0D50X0000C6eNNSSQ2/bug-fixes-stm32h7-ethernet

https://community.st.com/s/question/0D50X0000BOtfhnSQB/how-to-make-ethernet-and-lwip-working-on-stm32