title: What local interface was connection or packet received on?
body: <ol>
  <li>When receiving a packet on an unconnected UDP socket bound to <code>0.0.0.0</code>/<code>INADDR_ANY</code>, how can I determine what the local IP it was sent to?</li>
  <li>Can I determine what interface it was received on?</li>
  <li>Can this be also be done for connection-oriented sockets such as TCP?</li>
  </ol>
  
  <h2>Update0</h2>
  
  <ol>
  <li>Platform is Linux, so language is irrelevant but C is native.</li>
  <li>UDP sockets are bound to <code>INADDR_ANY</code> host, so <code>getsockname()</code> returns <code>0.0.0.0</code>.</li>
  </ol>