Wiznet / RP2040-HAT-C

Ethernet Example for RP2040
64 stars 35 forks source link

How to detect TCP disconnect #12

Closed arahasya closed 2 years ago

arahasya commented 2 years ago

I am setting pi pico as tcp client.

24 pico's are connected to a tcp server. After a few hours when the server is closed and started again some pico can be pinged but they don't connect to the server again.

I can't find the socket closed or disconnect flag / function anywhere.

Please help me. I need to detect socket disconnection immediately after the server is closed.

GiungKim commented 2 years ago

Hello @arahasya

'W5100S-EVB-Pico' or 'W5500-EVB-Pico', which one do you use?

You can get the socket status by reading the 'Sn_SR' register.

For details, refer to the 'Sn_SR' section of the datasheet below.