title: USB Serial Port on Mac using socat
body: <p>I have a piece of hardware that is connected over a Prolific Serial to USB cable and I need to use socat to send/receive traffic to/from this and a TCP port. So far it's installed and works fine with minicom using:</p>
  
  <p><code>minicom -D /dev/tty.usbserial -b 9600</code></p>
  
  <p>Socat works in one direction to a TCP port using:</p>
  
  <p><code>socat /dev/tty.usbserial,clocal=1,nonblock=1,cread=1,cs8,ixon=1,ixoff=1 TCP4:localhost:8080</code></p>
  
  <p>How do I get it working two way? I often see repeated characters or double lines which suggests an incorrect serial setup right?</p>
  
  <p>Thanks! Chris</p>
  
  <p>Edit:
  Some example code (that doesn't actually work in a bidirectional way).</p>
  
  <pre><code>Chris-MacBookAir:~ chrisbridges$ socat -d -d - /dev/tty.usbserial,clocal=1,nonblock=1,cs8,ixon=1,ixoff=1,ispeed=9600,ospeed=9600,icanon=1
  2013/01/09 13:13:34 socat[8501] N reading from and writing to stdio
  2013/01/09 13:13:34 socat[8501] N opening character device "/dev/tty.usbserial" for reading and writing
  2013/01/09 13:13:34 socat[8501] N starting data transfer loop with FDs [0,1] and [3,3]
  </code></pre>