title: C++ Socket Recv() and Network Interface going down
body: <p>I have written a client using plain sockets in C to connect to a remote machine to maintain a persistent connection so as to receive push messages. Everything works great. To make it persistent, I have set Keepalive and waiting on recv() function in a loop.</p>
  
  <p>The problem is, when the network interface goes down, the recv() does not return. As I understand from socket documentation that the peer has to disconnect for recv() to return. Network Interface going down is not the same as peer disconnecting.</p>
  
  <p>The need here is that if the network interface goes down, I need to schedule a reconnect so that the channel gets established.</p>
  
  <p>Any thoughts on this please?</p>