title: Read data from a COM port using TCP
body: <p>I'm using a <a href="http://www.moxa.com/product/nport_5650.htm" rel="nofollow noreferrer">Moxa Serial Hub</a> centralize some devices that communicate using RS-232 / NMEA protocol.</p>
  
  <p>The serial hub is working as a TCP client, witch every time it receives data transmits it to a know IP/port in my machine.</p>
  
  <p><img src="https://i.stack.imgur.com/oUF4n.gif" alt="schema"></p>
  
  <p>The problem is that I'm not receiving the data properly (I thought all I had to do was create a TCP server that accepts connections, and read the data as bytes, but that just gives me some weird characters)</p>
  
  <p>I receive the bytes...but when converting to text... its just some weird characters, I'm missing some detail in this conversion.
  so far I've tried:</p>
  
  <pre><code>byte[] b = new byte[1000];
  int k = s.Receive(b);
  Console.WriteLine(Encoding.UTF8.GetString(b, 0, 1000));
  Console.WriteLine(Encoding.ASCII.GetString(b));
  for (int i = 0; i &lt; k; i++)
     Console.Write(Convert.ToChar(b[i])); 
  </code></pre>
  
  <p>all these 3 approaches write the same text...</p>
  
  <p>Does any one know how to properly read the data in this cases?</p>