title: Using raw socket in Python
body: <p>I have this simple client code which is sending a message to a server and then echoes the server response.</p>
  
  <pre><code>import socket, sys, time
  
  
  HOST = 'localhost'   
  PORT = 11000             
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect((HOST, PORT))
  msg = raw_input()
  s.send(msg)
  data = s.recv(len(msg))
  s.close()
  print 'Received: ', data
  </code></pre>
  
  <p>I wish to use raw socket here in order to be able to get the IP_ID field out of the server's response packet, but I have no idea how.</p>
  
  <p>No matter how much I read about it on the internet I did not find a good example of how to do it.</p>
  
  <p>(Just to clarify, I don't really need to send a raw packet to the server, I can use the normal SOCK_STREAM to send the message, but I need to use raw socket to get the response' IP_ID.)</p>
  
  <p>Can anyone just edit my code and show me, in the simpliest way, how to do it? 
  All I managed to find out is that I need to replace socket.SOCK_STREAM with socket.SOCK_RAW, but im still far away.</p>
  
  <p>Thanks alot</p>