Skip to content

Instantly share code, notes, and snippets.

@andor44
Created May 28, 2013 16:40
Show Gist options
  • Save andor44/5664141 to your computer and use it in GitHub Desktop.
Save andor44/5664141 to your computer and use it in GitHub Desktop.
// on windows 7 64bit, the following program produces this output:
//D:\dev\rust>test.exe
//test4
//test1
//^C
//D:\dev\rust>
extern mod std;
use std::net::{tcp,ip};
use std::uv;
fn main()
{
let (port, chan) = stream::<~str>();
let localhost_v4 = ip::v4::parse_addr("127.0.0.1");
let local_port : uint = 9002;
let eventloop = uv::global_loop::get();
let (wait_port, wait_chan) = stream::<()>();
do task::spawn_sched(task::ManualThreads(1u)) {
io::println("test1");
let listen_result = tcp::listen(localhost_v4, local_port, 128, &eventloop,
|killchan| {
debug!("listener established");
io::println("test2");
},
|new_conn, killchan| {
debug!("new incoming connection!");
});
io::println("test3");
}
io::println("test4");
wait_port.recv();
io::println("test5");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment