Function mpstthree::transport::udp::cancel::cancel_udp

source ·
pub fn cancel_udp<T>(s: T, socket: UdpSocket)
Available on crate features transport or transport_udp only.
Expand description

Cancels a session. Always succeeds. If the partner calls send, recv or close after cancellation, those calls fail. Used for UDP transport.

Drops the session s and shutdowns the UdpSocket socket

§Example

use mpstthree::binary::struct_trait::end::End;
use mpstthree::binary::struct_trait::session::Session;
use mpstthree::meshedchannels::MeshedChannels;
use mpstthree::name::a::NameA;
use mpstthree::role::end::RoleEnd;
use mpstthree::transport::udp::cancel::cancel_udp;
use std::net::UdpSocket;

let socket = UdpSocket::bind("0.0.0.0:3333").unwrap();
let (s, _s_dual) = MeshedChannels::<End, End, RoleEnd, NameA>::new();
cancel_udp(s, socket);

This function is available only if MultiCrusty is built with the "transport" feature or the "transport_udp" feature.