pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */
<dev@bernhard-posselt.com> <nukeawhale@gmail.com>
<dev@bernhard-posselt.com> <raydiation@users.noreply.github.com>
<dev@bernhard-posselt.com> <bernhard@posselt.at>
<dev@bernhard-posselt.com> <BernhardPosselt@users.noreply.github.com>
<cosenal@gmail.com> <acosenti@malutchosky.(none)>
David-Development <david-dev@live.de>
<hey@morrisjobke.de> <morris.jobke@gmail.com>
Alessandro Cosentino <cosenal@gmail.com> Alessandro <cosenal@gmail.com>
Jenkins for ownCloud <owncloud-bot@tmit.eu> Jenkins for ownCloud <thomas.mueller@tmit.eu>
Thomas Müller <thomas.mueller@tmit.eu> Thomas Mueller <thomas.mueller@tmit.eu>
bastei <bastei@users.noreply.github.com> bastei <none>
Konrad Graefe <konradgraefe@aol.com> kgraefe <konradgraefe@aol.com>
<lukas@owncloud.com> <lukas@statuscode.ch>
<dev@ibboard.co.uk> <github@ibboard.co.uk>
summaryrefslogtreecommitdiffstats
span>= TcpListener::bind(&addr).unwrap(); // The server task asynchronously iterates over and processes each // incoming connection. let server = listener.incoming().for_each(|socket| { println!("accepted socket; addr={:?}", socket.peer_addr().unwrap()); let connection = io::write_all(socket, "hello world\n") .then(|res| { println!("wrote message; success={:?}", res.is_ok()); Ok(()) }); // Spawn a new task that processes the socket: tokio::spawn(connection); Ok(()) }) .map_err(|err| { // All tasks must have an `Error` type of `()`. This forces error // handling and helps avoid silencing failures. // // In our example, we are only going to log the error to STDOUT. println!("accept error = {:?}", err); }); println!("server running on localhost:6142"); // Start the Tokio runtime. // // The Tokio is a pre-configured "out of the box" runtime for building // asynchronous applications. It includes both a reactor and a task // scheduler. This means applications are multithreaded by default. // // This function blocks until the runtime reaches an idle state. Idle is // defined as all spawned tasks have completed and all I/O resources (TCP // sockets in our case) have been dropped. // // In our example, we have not defined a shutdown strategy, so this will // block until `ctrl-c` is pressed at the terminal. tokio::run(server); }