title: Null modem emulator (com0com) for linux
body: <p>I have a project that contains some unitary tests used to test the serial communications using COM ports (in windows). I use com0com to create a virtual pair of bounded ports and execute the tests.</p>
  
  <p>However I don't know how to do that in Linux neither in MACOS. I've read this topic: <a href="https://stackoverflow.com/questions/2175440/are-there-some-program-like-com0com-in-linux">Are there some program like COM0COM in linux?</a> Where the answer suggests using socat. I've tried that approach but it doesn't work, my application doesn't detect the ports I've just defined in socat.</p>
  
  <pre><code>socat PTY,link=/dev/COM98 PTY,link=/dev/COM99
  </code></pre>
  
  <p>My theory is that socat cannot create virtual ports, it can only bind together existing ports.</p>
  
  <p>How can I solve this issue?</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is what I get after running the previous socat command. If you look closely, you'll see that COM98 and COM99 ports are in /dev/. However if I write to /dev/COM98 and use <em>tail -f</em> to follow COM99 I don't get any output from it.</p>
  
  <p><img src="https://i.imgur.com/TEnND3F.png" alt="enter image description here"></p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>Well, if I use cat instead of tail I can see the output (why?!)</p>
  
  <p><img src="https://i.stack.imgur.com/VFK42.png" alt="enter image description here"></p>
  
  <p>'</p>
  
  <p>'</p>
  
  <p>'</p>
  
  <p><strong>EDIT3:</strong></p>
  
  <p><strong>SOLUTION:</strong> Don't name the ports COMxx but ttySxx instead!</p>
  
  <p>Example:</p>
  
  <pre><code>socat PTY,link=/dev/ttyS98 PTY,link=/dev/ttyS99
  </code></pre>
  
  <p>Reason why: Some serial-comm libraries may not support other nomenclature, such as RXTX 2.X.X and previous versions.</p>