Current state

This commit is contained in:
Johannes Wendel
2025-01-20 20:04:11 +01:00
parent 9887ac97ac
commit 8b76902f63
3 changed files with 23 additions and 9 deletions

1
src/lib.rs Normal file
View File

@@ -0,0 +1 @@
pub mod flutr;

View File

@@ -5,7 +5,6 @@ use image::ImageReader;
use clap::Parser;
mod flutr;
mod pixelmsgs;
use flutr::FlutR;

View File

@@ -1,6 +1,21 @@
use std::net::{TcpListener};
use std::{
net::TcpListener,
io::Read,
thread,
};
use std::io::Read;
use flutr::FlutR;
fn receive_bytes() -> [u8; 128]{
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
let mut stream = listener.accept().unwrap().0;
let mut buf: [u8; 128] = [0; 128];
stream.read(&mut buf).unwrap();
return buf;
}
#[cfg(test)]
@@ -9,14 +24,13 @@ mod tests {
#[test]
fn it_works() {
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
let mut stream = listener.accept().unwrap().0;
let receive_thread = thread::spawn(move || {return receive_bytes();});
let mut buf: [u8; 128] = [0; 128];
stream.read(&mut buf).unwrap();
let flutr_server = Flutr::new();
for x in buf {
let buf = receive_thread.join();
for x in buf.unwrap() {
print!("{x}, ");
}
}