示例#1
0
        protected void Send(byte[] tosend)
        {
            uint lpNumberOfBytesWritten = 0U;

            CheckOnline();
            CheckResult();
            m_writeCount = tosend.GetLength(0);
            if (Win32Com.WriteFile(m_hPort, tosend, (uint)m_writeCount, out lpNumberOfBytesWritten, m_ptrUWO))
            {
                m_writeCount -= (int)lpNumberOfBytesWritten;
            }
            else
            {
                if ((long)Marshal.GetLastWin32Error() != 997L)
                {
                    ThrowException("Send failed");
                }
            }
        }