![]() | PipeStreamRead Method |
Namespace: WinUsbNet
The total number of bytes read into buffer. This can be less than the number of bytes requested (including zero) if a short packet is received and the ReadUseShortPacket property is set to true.
Exception | Condition |
---|---|
IOException | The UsbDevice is not open. |
NotSupportedException | The PipeStream does not support reading. |
ArgumentNullException | buffer is null. |
ArgumentOutOfRangeException | offset or count is negative. |
ArgumentException | The sum of offset and count is larger than the buffer length. |
Win32Exception | An error was reported by the operating system. If NativeErrorCode is 0x00000079, the operation timed out. |
If the USB device returns more data than requested, the excess data will be stored in an internal buffer. Future calls to Read or ReadByte will read from the internal buffer until it is exhausted.
If the ReadUseShortPacket property is true, then a short packet received from the USB device will terminate the read transfer. The number of bytes received to that point will be returned.
If the ReadUseShortPacket property is false, then a short packet will not terminate the read transfer. The transfer will continue until the number of bytes requested has been received or the time limit specifed by ReadTimeout has been reached.