Skip to content

Instantly share code, notes, and snippets.

@aep
Created April 20, 2018 16:01
Show Gist options
  • Save aep/8f1f6ee62d9d87a0ff2e32c397e78495 to your computer and use it in GitHub Desktop.
Save aep/8f1f6ee62d9d87a0ff2e32c397e78495 to your computer and use it in GitHub Desktop.
let tcp = tcp
.map_err(|e| error!("Error: {}", e))
.map(move |stream| {
info!("connected");
let mut b = Vec::new();
tokio_io::io::read_to_end(stream, b)
.map_err(|e| error!("Error: {}", e))
.and_then(|(socket, b)| {
println!(">{:?}<", b);
ok(())
})
});
core.run(tcp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment