Skip to main content

send

Function send 

Source
pub async fn send(
    address: &Address,
    payload: &[u8],
    limit: Duration,
) -> Result<(), Error>
Expand description

Writes payload to address as given: one connection, or one datagram.

A tcp, unix or pipe send connects, writes the whole payload and closes the connection. A udp or unixgram send sends the payload as one datagram.

limit bounds the call, but a name lookup it cuts short keeps running on its blocking thread until the resolver answers.

ยงErrors

Fails with Error::Unsupported for an http or grpc address, which takes requests and not raw bytes, and for a socket or pipe this OS does not have. Fails with Error::Target when the connection or the write fails, including a datagram sent short, and Error::TimedOut when limit passes.