Struct asyncio::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 asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::Linger;

let ctx = &IoContext::new().unwrap();
let soc = TcpSocket::new(ctx, Tcp::v4()).unwrap();

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

Getting the option:

use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::Linger;

let ctx = &IoContext::new().unwrap();
let soc = TcpSocket::new(ctx, Tcp::v4()).unwrap();

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

Methods

impl Linger
[src]

Trait Implementations

impl Clone for Linger
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for Linger
[src]

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

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

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

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