mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
add "fountain" test to net suite
This commit is contained in:
parent
867b0efdf2
commit
ce116c2c0d
2 changed files with 43 additions and 0 deletions
|
|
@ -54,6 +54,9 @@ spectrum-analyzer = "0.5.2"
|
||||||
# used to parse net connectivity results
|
# used to parse net connectivity results
|
||||||
com_rs-ref = {path = "../../imports/com_rs-ref"}
|
com_rs-ref = {path = "../../imports/com_rs-ref"}
|
||||||
|
|
||||||
|
# for net testing
|
||||||
|
threadpool = "1.8.1"
|
||||||
|
|
||||||
# for the curve25519 tests
|
# for the curve25519 tests
|
||||||
# hardware acceleration adaptations are inserted into a fork of the main branch.
|
# hardware acceleration adaptations are inserted into a fork of the main branch.
|
||||||
rand_core = "0.5.1"
|
rand_core = "0.5.1"
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,46 @@ impl<'a> ShellCmdApi<'a> for NetCmd {
|
||||||
});
|
});
|
||||||
write!(ret, "TCP listener started on port 80").unwrap();
|
write!(ret, "TCP listener started on port 80").unwrap();
|
||||||
}
|
}
|
||||||
|
"fountain" => {
|
||||||
|
thread::spawn({
|
||||||
|
move || {
|
||||||
|
let tp = threadpool::ThreadPool::new(4);
|
||||||
|
loop {
|
||||||
|
let listener = std::net::TcpListener::bind("0.0.0.0:3333");
|
||||||
|
let listener = match listener {
|
||||||
|
Ok(listener) => listener,
|
||||||
|
Err(_) => {
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(1000));
|
||||||
|
continue;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
for i in listener.incoming() {
|
||||||
|
match i {
|
||||||
|
Err(error) => {
|
||||||
|
log::error!("error caught in listener.incoming(): {}", error);
|
||||||
|
},
|
||||||
|
Ok(mut stream) => {
|
||||||
|
tp.execute(move || {
|
||||||
|
let mut count = 0;
|
||||||
|
loop {
|
||||||
|
match std::io::Write::write(&mut stream, format!("hello! {}\n", count).as_bytes()) {
|
||||||
|
Err(e) => {
|
||||||
|
log::info!("fountain write failed with error {:?}", e);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
count += 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
write!(ret, "Fountain started on port 3333").unwrap();
|
||||||
|
}
|
||||||
// Testing of udp is done with netcat:
|
// Testing of udp is done with netcat:
|
||||||
// to send packets run `netcat -u <precursor ip address> 6502` on a remote host, and then type some data
|
// to send packets run `netcat -u <precursor ip address> 6502` on a remote host, and then type some data
|
||||||
// to receive packets, use `netcat -u -l 6502`, on the same remote host, and it should show a packet of counts received
|
// to receive packets, use `netcat -u -l 6502`, on the same remote host, and it should show a packet of counts received
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue