title: RS485 communication over TCP/IP
body: <p>I have a device which has a rs485 output and another gsm device connected to this output. </p>
  
  <p>I can access gsm device with a special IP and port. Gsm device is working transparently. Sending all data recieved from tcp socket to rs485, and retrieving data on rs485 then write to the opened tcp socket. </p>
  
  <p>connection between gsm device and rs485 existing device is wired and fix baudrate on 300. </p>
  
  <p>when I tried to read rs485 existing device with my laptop, connect rs485 to my usb, setting serial parameters like; <br/><br/></p>
  
  <ul>
  <li>parity : even </li>
  <li>databit : 7</li>
  <li>stopbit : 1</li>
  <li>baudrate : 300</li>
  </ul>
  
  <p>(This configuration is universal and described with a standard documentation)</p>
  
  <p>With this configuration everything is right and I can transfer data.</p>
  
  <p>When I tried to use gsm device, I have to manipulate the generated byte array to fit the rs485 exsiting device.</p>
  
  <p>for instance; <br />
  I want to send <code>/?![CR][LF]</code> as UTF-8.</p>
  
  <p>When using wired connection to device basically sending
  <code>"/?!\r\n".getBytes("UTF-8")</code> and device answering. </p>
  
  <p>When using gsm, I monitor over wireshark, device is only answering with byte array : <code>AF-3F-21-8D-A0</code></p>
  
  <p><code>AF</code> is signed format of <code>"/" - 2F</code></p>
  
  <p>Also <code>8D</code> is signed format of <code>[CR] - 0D</code></p>
  
  <p>I thinking that, the difference with bytes is causing from my configuration that used on serial connection. </p>
  
  <p>Is there a way to set this configurations (parity, stop, data bits ) when using tcp/ip sockets ? </p>
  
  <p>Thanks for your reply. </p>