pub struct TcpSock { /* fields omitted */ }
TCP socket which by default is uninitialized.
Asynchronous TCP socket wrapper with some specific behavior to our use cases:
TcpSock
takes care of message serialization and it's boundaries - no need to mess with the
byte stream.
- The maximum message length is
DEFAULT_MAX_PAYLOAD_SIZE
.
- Incoming/outgoing messages are buffered.
- All messages are encrypted with
EncryptContext
and decrypted with DecryptContext
that
can be changed at any time.
The socket is uninitialized by default and will result with SocketError
, if used.
Starts TCP connection. Returns immediately, so make sure to wait until the socket becomes
writable.
Starts TCP connection and uses given socket configuration. Returns immediately, so make
sure to wait until the socket becomes writable.
Wraps TcpStream
and uses default socket configuration.
Wraps TcpStream
and uses given socket configuration.
Specify data encryption context which will determine how outgoing data is encrypted.
Specify data decryption context which will determine how incoming data is decrypted.
Sets TCP SO_LINGER
value for the underlying socket.
Set Time To Live value for the underlying TCP socket.
Retrieve Time To Live value.
Returns local socket address.
Returns the address of the remote peer socket is connected to.
Retrieve last socket error, if one exists.
Read message from the socket. Call this from inside the ready
handler.
- Ok(Some(data)): data has been successfully read from the socket
- Ok(None): there is not enough data in the socket. Call
read()
again in the next invocation of the ready
handler.
- Err(error): there was an error reading from the socket.
Write a message to the socket.
- Ok(true): the message has been successfully written.
- Ok(false): the message has been queued, but not yet fully written.
will be attempted in the next write schedule.
- Err(error): there was an error while writing to the socket.
Returns the "default value" for a type. Read more
Formats the value using the given formatter. Read more
Register self
with the given Poll
instance. Read more
Re-register self
with the given Poll
instance. Read more
Deregister self
from the given Poll
instance Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
impl<T> DebugAny for T where T: Any + Debug, | |
impl<T> UnsafeAny for T where T: Any, | |