Skip to content

Commit

Permalink
ci
Browse files Browse the repository at this point in the history
  • Loading branch information
irvingoujAtDevolution committed Jan 22, 2024
1 parent e6139ea commit e8dba40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/network-scanner-net/examples/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::net::ToSocketAddrs;
use network_scanner_net::assume_init;
use tokio::io::{AsyncReadExt, AsyncWriteExt};

/// Context: Both Tokio/Mio and Polling uses the same OS's async IO API,
/// Context: Both Tokio/Mio and Polling uses the same OS's async IO API,
/// this example shows that it will not be a problem to use both of them in the same program.
/// The event loop managed by Tokio/Mio will not be affected by the raw socket and vice versa.
#[tokio::main]
Expand All @@ -27,13 +27,13 @@ pub async fn main() -> anyhow::Result<()> {

let handle = tokio::task::spawn(async move {
tracing::info!("connecting to cern using tokio");
let mut stream = tokio::net::TcpStream::connect(clone).await?;
let mut stream = tokio::net::TcpStream::connect(clone).await?;
tracing::info!("conncted to cern using tokio");
let _ = stream.write(request_clone.as_bytes()).await?;
let buf = &mut [0u8; 1024];
let size = stream.read(buf).await?;
Ok::<Vec<_>, anyhow::Error>(buf[..size].to_vec())
});
});

let handle_for_raw = tokio::task::spawn(async move {
socket.connect(&socket2::SockAddr::from(socket_addr)).await?;
Expand Down

0 comments on commit e8dba40

Please sign in to comment.