Disconnect() does not work

Hello,
In the disconnect() function the getSn_SR() returns SOCK_INIT instead of SOCK_CLOSED.
Can you help me understand why is that?

Thanks

After you send disconnect request to opponent you can receive ack message and then W5500 is closed.
But by some reason, if W5500 cannot ack message, it waits timeout. So until timeout occurred, the socket status is SOCK_INIT.

If W5500 cannot close, refer to RTR and RCR register.