Skip to content

Flush HID Write #246

@vnazar1985

Description

@vnazar1985

Hello.
I had a problem with the delay in sending packets to the network.
The problem was related to the fact that the actual sending did not happen immediately after calling the WriteAsync function or others. This happened after the function was called again, at which point two packets were already sent.
Since we have a packet protocol, it is advisable not to do caching.
So I added:
"_writeFileStream.Flush();"
In the file:
"src\Hid.Net\Windows\WindowsHidHandler.cs"
in function:
"public async Task WriteReportAsync(byte[] data, byte reportId, CancellationToken cancellationToken = default)"

Perhaps this is not an ideal option, and it should probably be done elsewhere in the library.
But it helped me.
Or it could be solved with some settings, I don't know for sure.
You can fix it, or explain to me how I could have done it differently.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions