Skip to content

Error: "The operation completed successfully." In tcp client example. #325

Open
@paul-fornage

Description

@paul-fornage

When running the example code, I am getting this when the slave device does not respond in time (on the order of half a second)

thread 'main' panicked at src\main.rs:12:45:
called `Result::unwrap()` on an `Err` value: Transport(Os { code: 0, kind: Uncategorized, message: "The operation completed successfully." })

I narrowed down the source of the error object to line below.

let res_adu = framed.next().await.ok_or_else(io::Error::last_os_error)??;

It should be said that I only had it happen on Windows, but on my main Linux machine not only did I not get that unhelpful message, but the error wouldn't happen at all. Not too surprising considering the message comes from a syscall. I'm less concerned about the fact that an error happened than I am about the unhelpful message. If you want me to try something to test a fix I will gladly do it, but I would suggest not relying on the 'get last error' syscall to trace the error. Or maybe wrap it with some extra context like "Failed to read response frame with OS error: {}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions