Skip to content

Flush HID Write #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vnazar1985 opened this issue Nov 22, 2023 · 0 comments
Open

Flush HID Write #246

vnazar1985 opened this issue Nov 22, 2023 · 0 comments

Comments

@vnazar1985
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant