TCPSocketConnection is_connected() still returns true after calling Socket::close()

21 May 2014

Subject says it all. In the source it looks like the TCPSocketConnection::_is_connected flag gets out of sync with the Socket::_sock_fd variable and remains true if one calls Socket::close(). Minor issue but it makes things difficult cleaning up to wait for another connection on the same TCPSocketConnection instance.

22 May 2014

did you wait before checking TCPSocketConnection::_is_connected?

There's a message handshake to close the connection and often the far end doesn't respond leading to a timeout. And a slow disconnect and free-up of the port number. Different IP stacks do this differently in my experience. Hence, one should not reuse the same socket number - should choose a higher but unused number, or some such as the timeout may take seconds.

You need to log in to post a reply