title: Recovering IP/Port from Socket Descriptor
body: <p>I'm writing <a href="https://github.com/konr/Licio/blob/master/05/myinetd.c" rel="noreferrer">a clone of inetd</a> in which I must run a server that prints the IP and port of the client connecting to it. </p>
  
  <p>As I overwrite <code>STDIN</code> and <code>STDOUT</code> with the socket descriptor, <a href="https://github.com/konr/Licio/blob/master/05/time.c" rel="noreferrer">my initial solution</a> to do this was to recover the <code>sockaddr_in</code> structure, which contains the needed information. Doing this with <code>getsockname()</code>, however, is returning an empty structure, with all bits set to 0.</p>
  
  <p>Any idea of what is wrong with my approach? Are there any other approaches I can use to recover the  IP/Port?</p>
  
  <p>Thanks</p>