Mercurial > projects > dreactor
view test/test.d @ 9:5412a1ff2e49
adding chat client and more updates
author | rick@minifunk |
---|---|
date | Sat, 12 Jul 2008 10:42:41 -0400 |
parents | 287ba7de97c4 |
children |
line wrap: on
line source
module test; import tango.net.Socket; import tango.core.Thread; import tango.io.Stdout; import dreactor.core.Vat; import dreactor.core.Dispatcher; import dreactor.protocol.RawTcp; import dreactor.transport.AsyncSocketConduit; int main() { AsyncSocketConduit cond = new AsyncSocketConduit; Dispatcher lh = new Dispatcher(cond, true); Vat l_vat = new Vat(); RawTCPListener listener = new RawTCPListener(lh, l_vat, new IPv4Address(5555)); l_vat.run(); AsyncSocketConduit clcond = new AsyncSocketConduit; Dispatcher ch = new Dispatcher(clcond); Vat c_vat = new Vat(); RawTCPClient client = new RawTCPClient(ch, c_vat); c_vat.run(); client.connect(new IPv4Address("localhost", 5555)); //Thread.sleep(1); client.send("This is a test"); return 0; }