-
-
Notifications
You must be signed in to change notification settings - Fork 23
tcdrain is always blocking ... #5
Comments
Sorry if I haven't answered you for a few days, but I'm very busy these days. So, isn't it supposed to be blocking? |
Yes, But you initialize the "CreateFile" in a way (as I understand it) that a Write-call only returns after write is complete ... you use it "non-overlapping" = "Synchron". But on windows the Write returnsonly after the write ewas complete, so a drain wait forever because No other write can happen ... |
Ok, understood. |
Yes, got an compile error then for some other code part, but not started to look deeper into it :-) If you want I can try to reproduce?! |
Hm ... tried it (it is the parameter after "OPEN_EXISTING") ... no compile error anymore ... hm ... |
yeah sorry, was the 6th argument, not the 7th |
test bresults: with
I get Error 87 on write to that serial socket.
Also tried "FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED" as in one Windows example from https://msdn.microsoft.com/de-de/library/windows/desktop/bb540534(v=vs.85).aspx More infos an overlapping I found on https://msdn.microsoft.com/en-us/library/windows/desktop/aa365683(v=vs.85).aspx ... for now I remove tcdrain usage with ifndef _WIN32 ... :-( |
Ok, digged deeper :-) When you do Overlapping communication then you also need to provide an OVERLAPPED struct to Read/Write operations and they become Really async. means: Directly after write you only get an info back but no info on bytes written. This you need to query with other commands and such. But I had an other idea: When I use this:
it works as expected or ?! See also: https://www.winehq.org/pipermail/wine-patches/2013-August/126115.html what you think ?! |
PS: I already use it that way in my version and it works :-) |
Ok, so it's enough to add FILE_FLAG_OVERLAPPED to createFile and change tcdrain in the way you did, right? |
NO! |
Ok, thank you |
... can it be because of the fact that the CreateFile is done in "non overlapping" mode ?!
When I understood it correctly "non overlapping" means that the WriteFile call returns after everything is written. So when you call a drain after the Write you will wait for an Event that never comes (because already was there?)
Could this be possible?
I also tried to set mode to overlapping, but then I got no successfull connect (or I forgot something).
For now I removed the drain, but if my above "idea" is true then the tcdrain should always return directly, or ?! Or you need to move to overlapping mode.
What fo you think?
The text was updated successfully, but these errors were encountered: