protected void Send(byte[] tosend) { uint lpNumberOfBytesWritten = 0; this.CheckOnline(); this.CheckResult(); this.writeCount = tosend.GetLength(0); if (Win32Com.WriteFile(this.hPort, tosend, (uint)this.writeCount, out lpNumberOfBytesWritten, this.ptrUWO)) { this.writeCount -= (int)lpNumberOfBytesWritten; } else { if (Marshal.GetLastWin32Error() != 0x3e5L) { this.ThrowException("Send failed"); } this.dataQueued = true; } }