c++ - How to check if socket is closed in Boost.Asio? -


What is the easiest way to check whether the socket has been turned off on the remote side of the connection? Socket :: is_open () Returns (I'm using boost :: asio :: ip :: tcp :: socket even if it is closed on the remote side).

I can try to read from the stream and see if it succeeds, but I have to change the logic of my program to work in this way (I do not want that data To be removed from the stream at the point of check).

If the connection has been explicitly closed by the co-worker should receive an EOF during reading Otherwise I usually ping to find out that the connection is actually alive.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -