-
Notifications
You must be signed in to change notification settings - Fork 74
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
Windows not freeing ports #37
Comments
It's certainly possible, though the actual low-level file handle work in windows should be taken care of by upstream I'm in the middle of bringing tokio-serial up to date with mio 0.7 and tokio 1.0. Tokio support with windows may have to wait until tokio-rs/tokio#3388 lands, but I plan on trying to have a stab at it with the code in that PR in the next few days. |
There was a possible double-drop in mio-serial for windows that has been addressed in the latest round of cleanup. If you're still interested, please try against the latest 5.4.0-beta on crates.io. |
Thanks for keeping me updated! |
If you're still curious, sure. No problem otherwise though, with the code you posted earlier I can test it myself at some point. |
I am trying to work out some similar "port-scan" feature in my project. And I get similar "Access Denied" issue on Windows. Just that my case is slightly different in that I am using tokio_util::codec::Framed to wrap tokio_serial::SerialStream and my codec. Firstly there is not an obvious api in tokio_util::codec::Framed to release the port. There is only a Then I tried this into_inner method to get tokio_serial::SerialStream from Framed thus I can run shutdown() method on the SerialStream instance. But I see it cannot free the resource. For now I've workarounded the issue by some design change in my code: Now I pass the same established connection from my "port-scan" logic to where my main logic. This way I avoid creating the tokio_serial::SerialStream connection twice on the same port.. |
Is there any update to this issue? |
I would also like to know if there are any updates to this issue. =) |
I met the same problem on linux while reading data from a bluetooth serial port. @imxood I've read the bug report you submitted in mio-serial, that's exactly my situation(I use mio-serial the same way as the package given example). |
We're using Rust application to talk to other devices using Serial COM ports.
I tried working on a "fast port search", which would connect to all ports asynchronously, write command and read the response to decide if it's the port it's looking for.
code
The above test should:
I'm not really sure, but I don't think
tokio_serial
frees COM ports after they're dropped, so we get anAccess Denied
OS error whenever we try to execute the third point.There's no direct
shutdown
(there is, but it doesn't seem to work) orclose
functions that would do what I'd like to do.I did also try manually dropping it
drop(port)
, but that didn't do the trick either.The text was updated successfully, but these errors were encountered: