title: C# send integer to python
body: <p>I am trying to send two integers to a python client script (which is running on a Linux machine) from a C# program (the server) which is running on a pc, using socket technology. Until now I am able to send strings. </p>
  
  <p>Server:</p>
  
  <pre><code>TcpListener listener = new TcpListener(IPAddress.Any, 12345);
  Invoke(new PrintMsg(printMsg), new object[] { "Trying to connect" });
  listener.Start();
  
  for(; ; ;)
  {
     TcpClient client = null;
  
     try
     {
        client = listener.AcceptTcpClient();
        netStream = client.GetStream();
        Invoke(new PrintMsg(printMsg), new object[] { "Found client" });
  
  
        //send command to client
        ASCIIEncoding encoder = new ASCIIEncoding();
        byte[] buffer = encoder.GetBytes("Hello client");
        netStream.Write(buffer, 0, buffer.Length);
        netStream.Flush();
  
     }
  
     catch (Exception ex)
     {
        Invoke(new PrintMsg(printMsg), new object[] { ex.ToString() });
     }
  }
  </code></pre>
  
  <p>And the client code is:</p>
  
  <pre><code>while True:
      msg = s.recv(1024)
      print 'SERVER:', msg
  </code></pre>
  
  <p>So I would like to "put" into a buffer array an integer and then send it to the python script. Is it possible? What am I doing wrong?</p>