Constant lrs::socket::msg::MSG_REAL_SIZE

Tells the kernel to use read sizes instead of truncated sizes.

Syntax

const MSG_REAL_SIZE: MsgFlags = MsgFlags(cty::MSG_TRUNC);

Remarks

This can be used when receiving on Udp or raw sockets and appears in message flags. When used with receiving calls, it tells the kernel to return the real size of the received message instead of the truncated one. If it appears in a message, then it means that a part of the message has been discarded because the provided buffer was too small.

Examples

use lrs::socket::msg::{RealSize};

let socket = {
    // Create a datagram socket
};

let mut buf = [0; 128];
let (size, _, _, flags) = socket.recv_msg(&mut buf, &mut [], &mut [],
                                          RealSize).unwrap();
if flags.is_set(RealSize) {
    println!("Received a truncated message: buffer size: {}, real size: {}",
             buf.len(), size);
}

See also