You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fn main() {
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
let pool = ThreadPool::new(4).expect("Init thread pool failed");
for stream in listener.incoming().take(2) {
let stream = stream.unwrap();
pool.execute(move || {
handle_connection(stream);
});
}
println!("Shutting down.");
}
and other codes are the same as this book, when I run the server, then use the Edge browser to access "localhost:7878" only once, I get the output:
Worker 0 got a job; executing.
Worker 1 got a job; executing.
Shutting down.
Shutting down worker 0
Worker 2 got a job; executing.
Worker 3 disconnected; shutting down.
Worker 0 disconnected; shutting down.
Worker 1 disconnected; shutting down.
Shutting down worker 1
Shutting down worker 2
I mean that one request but get two jobs, when I use: echo "hello" > /dev/tcp/127.0.0.1/7878
in Ubuntu, I get the proper output, one request, one job.
I really want to know the reason, thank you~
The text was updated successfully, but these errors were encountered:
my main function is :
and other codes are the same as this book, when I run the server, then use the Edge browser to access "localhost:7878" only once, I get the output:
I mean that one request but get two jobs, when I use:
echo "hello" > /dev/tcp/127.0.0.1/7878
in Ubuntu, I get the proper output, one request, one job.
I really want to know the reason, thank you~
The text was updated successfully, but these errors were encountered: