title: How to determine which interfaces a Linux socket is bound to in C++
body: <p>I have been trying to figure this out for a while now. Given a Linux socket, how can I </p>
  
  <ol>
  <li>Determine if it is bound?</li>
  <li>If it is bound, determine which subset of network interfaces it bound to on a multihomed system?</li>
  </ol>
  
  <p>In short I have a machine with multiple network cards and a socket that is only bound to a subset of these cards. I want to programmatically detect and log these interfaces after they have been bound else where in our libraries meaning I don't have access to this infnormation at the time of binding.  </p>
  
  <p>I should also point out that I need an IPV4/6 compatible solution preferably for that works with SCTP sockets (though I'm fine with UDP or TCP solutions for now) </p>