Struct asio::socket_base::Linger [] [src]

pub struct Linger(_);

Socket option to specify whether the socket lingers on close if unsent data is present.

Implements the SOL_SOCKET/SO_LINGER socket option.

Examples

Setting the option:

use asio::*;
use asio::ip::*;
use asio::socket_base::Linger;

let io = &IoService::new();
let soc = TcpSocket::new(io, Tcp::v4()).unwrap();

soc.set_option(Linger::new(Some(30))).unwrap();

Getting the option:

use asio::*;
use asio::ip::*;
use asio::socket_base::Linger;

let io = &IoService::new();
let soc = TcpSocket::new(io, Tcp::v4()).unwrap();

let opt: Linger = soc.get_option().unwrap();
let is_set: Option<u32> = opt.get();

Methods

impl Linger
[src]

fn new(timeout: Option<u32>) -> Linger

fn get(&self) -> Option<u32>

Trait Implementations

impl Clone for Linger
[src]

fn clone(&self) -> Linger

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 Linger
[src]

fn default() -> Linger

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

impl<P: Protocol> SocketOption<P> for Linger
[src]

type Data = c_void

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

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

impl<P: Protocol> GetSocketOption<P> for Linger
[src]

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

fn resize(&mut self, _size: usize)

impl<P: Protocol> SetSocketOption<P> for Linger
[src]

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

fn size(&self) -> usize