title: Sending array of bytes to socket server
body: <p>I have two lamps, which I can switch on/off by socket. I have a socket server and have to create a client. The client has sent an array of 4 bytes. First byte - id of command (on/of), second id lamp, etc.<br>
  I have code in C#:</p>
  
  <pre><code>void BtnCmd22Click(object sender, EventArgs e)
          {
                  if (clientSocket.Connected) 
                  {
                      Byte[] mes = new Byte[4];   
  
                      mes[0] = 0x22;
                      mes[1] = (byte)cmbCmd22_0.SelectedIndex;
                      mes[2] = (byte)cmbCmd22_1.SelectedIndex;
                      mes[3] = (byte)nmCmd22_2.Value
  
                      serverStream.Write(mes, 0, 4);
                      serverStream.Flush();
  }}
  </code></pre>
  
  <p>And I have to re-write it in Python. What I try:</p>
  
  <pre><code>HOST = 'some_host'  # Standard loopback interface address (localhost)
  PORT = 9090       # Port to listen on (non-privileged ports are &gt; 1023)
  
  b = bytearray(4)
  
  b[0] = 0x22
  b[1] = 1
  b[2] = 1
  b[3] = 0
  
  
  with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
  
      s.connect((HOST, PORT))
      s.send(b)
  </code></pre>
  
  <p>Also I try packers, but it isn't work. Where is the mistake?  </p>