Skip to main content

UDP

A UDP channel isn't connected to one outstation, so each association on it also needs the outstation's address and port. Create the channel with the local address and port it listens on, then add each association with its remote endpoint:

let channel = spawn_master_udp(
local_endpoint,
LinkReadMode::Datagram,
Timeout::from_secs(5)?,
get_master_channel_config(master_address)?,
);

let association = channel
.add_udp_association(
outstation_address,
remote_endpoint,
get_association_config(),
Box::new(ExampleReadHandler),
Box::new(ExampleAssociationHandler),
Box::new(ExampleAssociationInformation),
)
.await?;