First, you need to link the library with your executable (or another library) by putting anevicon_core
to the dependencies
section in your Cargo.toml
like this:
toml
[dependencies]
anevicon_core = "*"
Next, just copy this code into your main
function and launch the compiled program, which simply sends one thousand empty packets to the example.com
site:
```rust
use aneviconcore::summary::TestSummary;
use aneviconcore::testing::send;
// Setup the socket connected to the example.com domain let socket = std::net::UdpSocket::bind("0.0.0.0:0").unwrap(); socket.connect("93.184.216.34:80").unwrap();
let packet = vec![0; 32768]; let mut summary = TestSummary::default();
// Execute a test that will send one thousand packets // each containing 32768 bytes. for _ in 0..1000 { if let Err(error) = send(&socket, &packet, &mut summary) { panic!("{}", error); } }
println!( "The total seconds passed: {}", summary.timepassed().assecs() ); ```
For more details please look through the official documentation.