Struct net2::TcpBuilder [] [src]

pub struct TcpBuilder {
    // some fields omitted
}

Methods

impl TcpBuilder
[src]

fn new_v4() -> Result<TcpBuilder>

Constructs a new TcpBuilder with the AF_INET domain, the SOCK_STREAM type, and with a protocol argument of 0.

Note that passing other kinds of flags or arguments can be done through the FromRaw{Fd,Socket} implementation.

fn new_v6() -> Result<TcpBuilder>

Constructs a new TcpBuilder with the AF_INET6 domain, the SOCK_STREAM type, and with a protocol argument of 0.

Note that passing other kinds of flags or arguments can be done through the FromRaw{Fd,Socket} implementation.

fn bind<T>(&self, addr: T) -> Result<&TcpBuilder> where T: ToSocketAddrs

Binds this socket to the specified address.

This function directly corresponds to the bind(2) function on Windows and Unix.

fn listen(&self, backlog: i32) -> Result<TcpListener>

Mark a socket as ready to accept incoming connection requests using accept()

This function directly corresponds to the listen(2) function on Windows and Unix.

An error will be returned if listen or connect has already been called on this builder.

fn connect<T>(&self, addr: T) -> Result<TcpStream> where T: ToSocketAddrs

Initiate a connection on this socket to the specified address.

This function directly corresponds to the connect(2) function on Windows and Unix.

An error will be returned if listen or connect has already been called on this builder.

fn to_tcp_stream(&self) -> Result<TcpStream>

Converts this builder into a TcpStream

This function will consume the internal socket and return it re-wrapped as a TcpStream. An error will be returned if the internal socket has already been consumed from a successful call to connect, listen, etc.

fn to_tcp_listener(&self) -> Result<TcpListener>

Converts this builder into a TcpListener

This function will consume the internal socket and return it re-wrapped as a TcpListener. An error will be returned if the internal socket has already been consumed from a successful call to connect, listen, etc.

impl TcpBuilder
[src]

fn ttl(&self, ttl: u32) -> Result<&Self>

fn only_v6(&self, only_v6: bool) -> Result<&Self>

fn reuse_address(&self, reuse: bool) -> Result<&Self>

Trait Implementations

impl Debug for TcpBuilder
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl FromRawSocket for TcpBuilder
[src]

unsafe fn from_raw_socket(fd: SOCKET) -> TcpBuilder

Creates a new I/O object from the given raw socket. Read more

impl AsRawSocket for TcpBuilder
[src]

fn as_raw_socket(&self) -> SOCKET

Extracts the underlying raw socket from this object.