Function mpstthree::transport::udp::cancel::cancel_udp[][src]

pub fn cancel_udp<T>(s: T, socket: UdpSocket)
This is supported 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::role::a::RoleA;
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, RoleA<RoleEnd>>::new();
cancel_udp(s, socket);

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