Struct net2::TcpBuilder [] [src]

pub struct TcpBuilder { /* fields omitted */ }

An "in progress" TCP socket which has not yet been connected or listened.

Allows configuration of a socket before one of these operations is executed.

Methods

impl TcpBuilder
[src]

[src]

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.

[src]

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.

[src]

Binds this socket to the specified address.

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

[src]

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.

[src]

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.

[src]

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.

[src]

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.

[src]

Returns the address of the local half of this TCP socket.

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

impl TcpBuilder
[src]

[src]

Sets the value for the IP_TTL option on this socket.

This is the same as TcpStreamExt::set_ttl.

[src]

Sets the value for the IPV6_V6ONLY option on this socket.

This is the same as TcpStreamExt::set_only_v6.

[src]

Set value for the SO_REUSEADDR option on this socket.

This indicates that futher calls to bind may allow reuse of local addresses. For IPv4 sockets this means that a socket may bind even when there's a socket already listening on this port.

[src]

Check the SO_REUSEADDR option on this socket.

[src]

Get the value of the SO_ERROR option on this socket.

This will retrieve the stored error in the underlying socket, clearing the field in the process. This can be useful for checking errors between calls.

Trait Implementations

impl Debug for TcpBuilder
[src]

[src]

Formats the value using the given formatter. Read more

impl FromRawFd for TcpBuilder
[src]

[src]

Constructs a new instance of Self from the given raw file descriptor. Read more

impl AsRawFd for TcpBuilder
[src]

[src]

Extracts the raw file descriptor. Read more

impl UnixTcpBuilderExt for TcpBuilder
[src]

[src]

Set value for the SO_REUSEPORT option on this socket. Read more

[src]

Check the value of the SO_REUSEPORT option on this socket.