title: Send byte over tcp python
body: <p>I am going to send a byte string over tcp channel by python,
  the bit string has 3 bytes "000010010000000000001001" that if I look at it as 3 integers it is '909'</p>
  
  <p>Sender Code:</p>
  
  <pre><code>import socket
  import struct
  TCP_IP = '127.0.0.1' 
  TCP_PORT = 5005      
  BUFFER_SIZE = 1024
  MESSAGE = b"000010010000000000001001"
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect((TCP_IP, TCP_PORT))
  s.send(MESSAGE)
  data = s.recv(BUFFER_SIZE)
  s.close()
  print( "received data:", data)
  </code></pre>
  
  <p>Receiver Code:</p>
  
  <pre><code>import socket
  TCP_IP = '127.0.0.1'
  TCP_PORT = 5005
  BUFFER_SIZE = 1024 
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.bind((TCP_IP, TCP_PORT))
  s.listen(1)
  conn, addr = s.accept()
  print('Connection address:', addr)
  while 1:
      data = conn.recv(BUFFER_SIZE)
      if not data: break
      print( "received data:", data)
      conn.send(data)  
  conn.close()
  </code></pre>
  
  <p>I run the programs and captured the data with Wireshark and the packets were totally different, in hex representation: </p>
  
  <pre><code>30 30 30 30 31 30 30 31 30 30 30 30 30 30 30 30 30 30 30 30 31 30 30 31
  </code></pre>
  
  <p>So instead of sending bytes, I am sending strings. <code>hex(ord('1')) == 0x31</code> and <code>hex(ord('0')) == 0x30</code>.</p>
  
  <p>How can I really send bytes?</p>