Function libp2p::core::upgrade::write_with_len_prefix[][src]

pub async fn write_with_len_prefix(
    socket: &'_ mut impl Unpin + AsyncWrite,
    data: impl AsRef<[u8]>
) -> Result<(), Error>

Send a message to the given socket with a length prefix appended to it. Also flushes the socket.

Note: Prepends a variable-length prefix indicate the length of the message. This is compatible with what read_one expects.