title: Obtain source and destination IP address from socket.recv versus s.recvfrom
body: <p>I have programmed a packet capture tool in python, I'm using the following code:</p>
  
  <pre><code>packet = socket.recv(sipLocatorConfig.NETWORK_TCP_MAX_SIZE)
  eth_length = 14
  ip_header = packet[eth_length:20+eth_length]          
  #now unpack them 
  iph = unpack('!BBHHHBBH4s4s' , ip_header)
  version_ihl = iph[0]
  version = version_ihl &gt;&gt; 4
  ihl = version_ihl &amp; 0xF
  iph_length = ihl * 4
  ttl = iph[5]
  protocol = iph[6]
  t = iph_length + eth_length           
  tcp_header = packet[t:t+20]
  tcph = unpack('!HHLLBBHHH',tcp_header)
  source_port = tcph[0]
  dest_port = tcph[1]
  s_addr1 = socket.inet_ntoa(iph[8]);
  d_addr1 = socket.inet_ntoa(iph[9]);
  </code></pre>
  
  <p>I'm getting the following error:</p>
  
  <pre><code>'_socketobject' object has no attribute 'inet_ntoa'
  </code></pre>
  
  <p>How to obtain source address and destination address of my captured packet ?
  This works fine with <code>packet = s.recvfrom(sipLocatorConfig.NETWORK_MAX_SIZE)</code>
  Thanks</p>