Struct asio::ip::UnicastHops [] [src]

pub struct UnicastHops(_);

Socket option for time-to-live associated with outgoing unicast packets.

Implements the IPPROTO_IP/IP_UNICAST_TTL or IPPROTO_IPV6/IPV6_UNICAST_HOPS socket option.

Examples

Setting the option:

use asio::*;
use asio::ip::*;

let io = &IoService::new();
let soc = UdpSocket::new(io, Udp::v4()).unwrap();

soc.set_option(UnicastHops::new(4)).unwrap();

Getting the option:

use asio::*;
use asio::ip::*;

let io = &IoService::new();
let soc = UdpSocket::new(io, Udp::v4()).unwrap();

let opt: UnicastHops = soc.get_option().unwrap();
let hops: u8 = opt.get();

Methods

impl UnicastHops
[src]

fn new(ttl: u8) -> UnicastHops

fn get(&self) -> u8

fn set(&mut self, ttl: u8)

Trait Implementations

impl Clone for UnicastHops
[src]

fn clone(&self) -> UnicastHops

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Default for UnicastHops
[src]

fn default() -> UnicastHops

Returns the "default value" for a type. Read more

impl<P: IpProtocol> SocketOption<P> for UnicastHops
[src]

type Data = i32

fn level(&self, pro: &P) -> i32

fn name(&self, pro: &P) -> i32

impl<P: IpProtocol> GetSocketOption<P> for UnicastHops
[src]

fn data_mut(&mut self) -> &mut Self::Data

fn resize(&mut self, _size: usize)

impl<P: IpProtocol> SetSocketOption<P> for UnicastHops
[src]

fn data(&self) -> &Self::Data

fn size(&self) -> usize