title: Python 3 Socket Receive Data
body: <p>I am working with python sockets and although I have read everything I can find on stackoverflow, regarding the socket.recv byte stream, I still have a few questions I hope some of you can answer.</p>
  
  <p>So I have this line:</p>
  
  <pre><code>chunk = s.recv(1024)
  </code></pre>
  
  <p>I receive the following packet: <code>'\x12\x03\x10\x00\x00\x00\x00\x23\x45\x34\x56'</code></p>
  
  <p>I need to get bytes at index <code>1</code> &amp; <code>2</code> ('\x03\x10') and convert the 2-byte data to an integer .. which should be 784.</p>
  
  <p>What is the best way to handle this?</p>
  
  <p>In addition, what is the best way to remove a portion of the chunk data and pass it into a function? I.E. I need to remove bytes at index 7 - 9 and pass that string of 3 bytes into a function.</p>