Ejemplo n.º 1
0
 protected void WriteComm(byte[] buf)
 {
     new Thread(() =>
     {
         NativeOverlapped ov = new System.Threading.NativeOverlapped();
         if (!GWin32.WriteFileEx(m_hCommPort, buf, (uint)buf.Length, ref ov, (uint err, uint b, ref NativeOverlapped c) =>
         {
             if (err != 0)
             {
                 Console.WriteLine("Write come done " + err);
             }
             Console.WriteLine("Write come done tran=" + b);
         }))
         {
             Console.WriteLine("failed write comm " + getWinErr());
         }
         // IOCompletion routine is only called once this thread is in an alertable wait state.
         gwait();
     }).Start();
 }