title: Hyper-V: Connecting VMs through named pipe loses data
body: <p>We are trying to connect two Hyper-V VMs through a serial port. Hyper-V exposes the serial port as a named pipe to the host system, and implements the server end of the named pipe. Consequentially, to connect them, we need to write a named-pipe client which connects to both VMs, and copies the data back and forth.</p>
  
  <p><a href="http://pastebin.com/qPPh8FbR" rel="nofollow">We have written such an application</a>. Unfortunately, <strong>this application loses data</strong>.</p>
  
  <p>If we connect two hyperterms, and have them exchange data, the transmission sometimes succeeds, but in many cases, the receiving end reports errors, or the transmission just deadlocks. Likewise, if we use the link to run a kernel debugger, it also seems to hang often.</p>
  
  <p>What could be the cause of the data loss? What precautions must be taken when connecting named pipes in such a manner?</p>
  
  <p><strong>Edit</strong>: We have worked around the problem, using <a href="http://msdn.microsoft.com/en-us/library/ff551859%28v=VS.85%29.aspx" rel="nofollow">kdsrv.exe</a>. The COM port of the debuggee continues to be exposed through a named pipe, however, the debugger end talks to kdserv via TCP.</p>