Reputation: 21
I am using boost asio for my TCP Server, in this I am using async_read_some for reading . Application is working fine when network is connected, normal connection closing are handled correctly like (EOF,abrupt closing). But my problem is I am not getting any error when network cable is unplugged. socket is open , and I get error when I am writing on socket. This is the way socket work. Question: Can this is handled in Boost asio by any method?
Upvotes: 2
Views: 932
Reputation: 4549
You may want to set "keep alive" on the socket, see Socket closed notification. Try:
socket.set_option(boost::asio::socket_base::keep_alive(true));
Upvotes: 3