title: Getting IP address of the beagleboard using python
body: <pre><code>SIOCGIFADDR = 0x8915
  
  def getIpAddr(iface = 'eth0'):
  
       ifreq = struct.pack('16sH14s', iface, socket.AF_INET, '\x00'*14)
       try:
           res = fcntl.ioctl(sock, SIOCGIFADDR, ifreq)
       except:
           return None   
       ip = struct.unpack('16sH2x4s8x', res)[2]
       return socket.inet_ntoa(ip)
  </code></pre>
  
  <p>At each step what are the return values of the functions? 
  And, what is SIOCGIFADDR? 
  Also, why <code>[2]</code> has been used following the <code>unpack()</code> function?</p>