Create Your Own Event Queue 86 The first part of the main function looks like this: fn main()-> Result<()> { let mut poll = Poll::new()?; let n_events = 5; let mut streams = vec![]; let addr = "localhost:8080"; for i in 0..n_events { let delay = (n_events-i) * 1000; let url_path = format!("/{delay}/request-{i}"); let request = get_req(&url_path); let mut stream = std::net::Tcp Stream::connect(addr)?; stream. set_nonblocking(true)?; stream. write_all(request. as_bytes())?; poll. registry() . register(&stream, i, ffi::EPOLLIN | ffi::EPOLLET)?; streams. push(stream); } The first thing we do is to create a new Poll instance. We also specify what number of events we want to create and handle in our example. The next step is creating a variable to hold a collection of Vec<Tcp Stream> objects. We also store the address to our local delayserver in a variable called addr. The next part is where we create a set of requests that we issue to our delayserver, which will eventually respond to us. For each request, we expect a read event to happen sometime later on in the Tcp Stream we sent the request on. The first thing we do in the loop is set the delay time in milliseconds. Setting the delay to (n_events -i) * 1000 simply sets the first request we make to have the longest timeout, so we should expect the responses to arrive in the reverse order from which they were sent.