title: how to connect 2 applications through a pseudo serial port with socat
body: <p>I am developing an embedded application. It will be running on a full-fledged embedded linux, but will be controlled through commands arriving from the serial port from a windows host. </p>
  
  <p>during the debug phase, this windows host is running in a virtual machine and the embedded application is run locally. As such I would like for these 2 to communicate normally as if a normal usb (to serial) cable was connected between them.</p>
  
  <p>How do I go about it? I have heard of the notion of pseudo ports (/dev/ptyXX) but haven't found any C tutorial to go about it.</p>
  
  <p>I basically expect something like a device node (or 2), so I can assign one  node to virtualbox "serial port" settings and assign the other node to my linux applicatio that is currently running on the linux host.</p>
  
  <p>Thank you for your help</p>
  
  <p>EDIT: it looks like <code>socat</code> might be the tool for the job , but I can't quite grab the way it works. I am trying the command:</p>
  
  <pre><code>socat -d -d PTY:link=/home/nass/acm0,raw,echo=0 UNIX-CONNECT:/home/nass/dm0 
  
  2013/07/18 17:53:56 socat[13271] N PTY is /dev/pts/10
  2013/07/18 17:53:56 socat[13271] N opening connection to AF=1 "/home/nass/dm0"
  2013/07/18 17:53:56 socat[13271] E connect(5, AF=1 "/home/nass/dm0", 16): Connection refused
  2013/07/18 17:53:56 socat[13271] N exit(1)
  </code></pre>
  
  <p>Why is the connection refused? 
  If <code>/home/nass/dm0</code> is missing, the virtual machine will fail to startup (both in host pipe and host device cases)</p>
  
  <p>I pre-created the node /home/nass/dm0 as a file with <code>touch /home/nass/dm0</code>. how should I setup virtualbox? host device? host pipe?</p>
  
  <p>should dm0 even exist before powering up the virtual machine? if yes, should it be a file created with <code>touch /home/nass/dm0</code>? If it should be a socket, how do I pre-create it?</p>