pub fn send_to_stream(stream: &mut TcpStream, data: &[u8]) {
    let size: [u8; 1] = u8::to_be_bytes(data.len() as u8);
    let mut message: Vec<u8> = Vec::new();
    message.extend_from_slice(&size);
    message.extend_from_slice(data);

    stream.write_all(&message).unwrap();
}
/// Sends bytes to stream, with the buffer length appended to the beginning as an u8 integer
Sends bytes to stream, with the buffer length appended to the beginning as an u8 integer
Sends bytes to stream with the buffer length appended to the beginning as an u8 integer
pub fn send_to_stream(stream: &mut TcpStream, data: &[u8]) {
    let size: [u8; 1] = u8::to_be_bytes(data.len() as u8);
    let mut message: Vec<u8> = Vec::new();
    message.extend_from_slice(&size);
    message.extend_from_slice(data);
    stream.write_all(&message).unwrap();
}
pub fn send_to_stream ( stream : & mut TcpStream , data : & [ u8 ] ) { let size : [ u8 ; 1 ] = u8 :: to_be_bytes ( data . len ( ) as u8 ) ; let mut message : Vec < u8 > = Vec :: new ( ) ; message . extend_from_slice ( & size ) ; message . extend_from_slice ( data ) ; stream . write_all ( & message ) . unwrap ( ) ; }
Sends bytes to stream, with the buffer length appended to the beginning as an u8 integer
Sends bytes to stream with the buffer length appended to the beginning as an u8 integer
stream
&mut TcpStream
data
&[u8]
stream
&mut TcpStream
data
&[u8]