Enum amq_protocol_tcp::TcpStream [−][src]
Expand description
Re-export TcpStream Wrapper around plain or TLS TCP streams
Variants
Wrapper around mio’s TcpStream
Wrapper around a TLS stream hanled by native-tls
Implementations
Re-export TcpStream
Wrapper around mio’s TcpStream::connect inspired by std::net::TcpStream::connect
pub fn connect_timeout<A>(
addr: A,
timeout: Duration
) -> Result<TcpStream, Error> where
A: ToSocketAddrs,
pub fn connect_timeout<A>(
addr: A,
timeout: Duration
) -> Result<TcpStream, Error> where
A: ToSocketAddrs,
Wrapper around mio’s TcpStream::connect inspired by std::net::TcpStream::connect_timeout and std::net::TcpStream::connect. We used the timeout on the first SocketAddr.
Wrapper around mio’s TcpStream::from_std
Check whether the stream is connected or not
Retry the connection. Returns:
- Ok(true) if connected
- Ok(false) if connecting
- Err(_) if an error is encountered
Enable TLS
pub fn into_native_tls(
self,
connector: TlsConnector,
domain: &str
) -> Result<TcpStream, HandshakeError>
pub fn into_native_tls(
self,
connector: TlsConnector,
domain: &str
) -> Result<TcpStream, HandshakeError>
Enable TLS using native-tls
Re-export TcpStream
Attempt reading from underlying stream, returning Ok(()) if the stream is readable
Attempt writing to underlying stream, returning Ok(()) if the stream is writable
Methods from Deref<Target = TcpStream>
Returns the socket address of the remote peer of this TCP connection.
Returns the socket address of the local half of this TCP connection.
Shuts down the read, write, or both halves of this connection.
This function will cause all pending and future I/O on the specified
portions to return immediately with an appropriate value (see the
documentation of Shutdown
).
Sets the value of the TCP_NODELAY
option on this socket.
If set, this option disables the Nagle algorithm. This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets.
Notes
On Windows make sure the stream is connected before calling this method,
by receiving an (writable) event. Trying to set nodelay
on an
unconnected TcpStream
is undefined behavior.
Gets the value of the TCP_NODELAY
option on this socket.
For more information about this option, see set_nodelay
.
Notes
On Windows make sure the stream is connected before calling this method,
by receiving an (writable) event. Trying to get nodelay
on an
unconnected TcpStream
is undefined behavior.
Sets the value for the IP_TTL
option on this socket.
This value sets the time-to-live field that is used in every packet sent from this socket.
Notes
On Windows make sure the stream is connected before calling this method,
by receiving an (writable) event. Trying to set ttl
on an
unconnected TcpStream
is undefined behavior.
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.
Receives data on the socket from the remote address to which it is connected, without removing that data from the queue. On success, returns the number of bytes peeked.
Successive calls return the same data. This is accomplished by passing
MSG_PEEK
as a flag to the underlying recv system call.
Trait Implementations
Performs the conversion.
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Like read
, except that it reads into a slice of buffers. Read more
Read all bytes until EOF in this source, placing them into buf
. Read more
Read all bytes until EOF in this source, appending them to buf
. Read more
Read the exact number of bytes required to fill buf
. Read more
can_vector
)Determines if this Read
er has an efficient read_vectored
implementation. Read more
read_initializer
)Determines if this Read
er can work with buffers of uninitialized
memory. Read more
Creates a “by reference” adapter for this instance of Read
. Read more
Creates an adapter which will chain this stream with another. Read more
Write a buffer into this writer, returning how many bytes were written. Read more
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Attempts to write an entire buffer into this writer. Read more
Writes a formatted string into this writer, returning any error encountered. Read more
can_vector
)Determines if this Write
r has an efficient write_vectored
implementation. Read more
write_all_vectored
)Attempts to write multiple buffers into this writer. Read more