We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
async fn main() -> Result<()> { { let mut ctx1 = get_ctx(&get_default_sp_builder(), 2)?; let rsp1 = ctx1.read_holding_registers(1, 2).await?; println!("{rsp1:?}"); ctx1.disconnect().await?; }
let mut ctx2 = get_ctx(&get_default_sp_builder(), 1)?; let rsp2 = ctx2.read_holding_registers(1, 2).await?; println!("{rsp2:?}"); ctx2.disconnect().await?; Ok(())
}
above is my code, the rsp1 is right, but failed at the ctx2 row What is the right method? thanks!
The text was updated successfully, but these errors were encountered:
Context? Fails how?
Sorry, something went wrong.
there are two contexts, the ctx1 works normal, then the ctx1.disconnect().await? is not take effect, so the ctx2 panic because access is denied.
get_ctx() and get_default_sp_builder() are not provided by tokio-modbus and I cannot comment on this. Everything might happen behind the scenes.
get_ctx()
get_default_sp_builder()
Please re-open if you could provide a runnable or at least comprehensible example.
No branches or pull requests
async fn main() -> Result<()> {
{
let mut ctx1 = get_ctx(&get_default_sp_builder(), 2)?;
let rsp1 = ctx1.read_holding_registers(1, 2).await?;
println!("{rsp1:?}");
ctx1.disconnect().await?;
}
}
above is my code, the rsp1 is right, but failed at the ctx2 row
What is the right method? thanks!
The text was updated successfully, but these errors were encountered: