diff --git a/hptp-send/src/main.rs b/hptp-send/src/main.rs index 4c2f808..95cfe39 100644 --- a/hptp-send/src/main.rs +++ b/hptp-send/src/main.rs @@ -65,11 +65,25 @@ fn parse_args(mut args: impl Iterator) -> Result Result<(), Error> { - sock.send_to("Hello, ".as_bytes(), targ_addr).await?; - sock.send_to("world!".as_bytes(), targ_addr).await?; + let contents: String = (0..100).flat_map(|_| "Hello world ".chars()).collect(); + + for i in 0.. { + let (idx, part) = { + let width = 50; + let lo = i * width; + let hi = std::cmp::min((i + 1) * width, contents.len()); + if lo >= contents.len() { + break; + }; + (lo, &contents[lo..hi]) + }; + sock.send_to(part.as_bytes(), targ_addr).await?; + log.send_data(idx, part.len()).await; + } + Ok(()) }