Struct asyncio::socket_base::ReuseAddr [] [src]

pub struct ReuseAddr(_);

Socket option to allow the socket to be bound to an address that is already in use.

Implements the SOL_SOCKET/SO_REUSEADDR socket option.

Examples

Setting the option:

use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::ReuseAddr;

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

soc.set_option(ReuseAddr::new(true)).unwrap();

Getting the option:

use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::ReuseAddr;

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

let opt: ReuseAddr = soc.get_option().unwrap();
let is_set: bool = opt.get();

Methods

impl ReuseAddr
[src]

Trait Implementations

impl Default for ReuseAddr
[src]

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

impl Clone for ReuseAddr
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

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

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