Mercurial > projects > dreactor
view test/chatclient.d @ 7:2c6ab06a8829
fixed up for chatserver
author | rick@minifunk |
---|---|
date | Wed, 09 Jul 2008 00:32:11 -0400 |
parents | |
children | 5412a1ff2e49 |
line wrap: on
line source
module chatclient; import tango.net.Socket; import tango.core.Thread; import tango.io.Stdout; import tango.io.Console; import tango.util.log.Log; import dreactor.core.Vat; import dreactor.core.Dispatcher; import dreactor.protocol.RawTcp; import dreactor.transport.AsyncSocketConduit; int main() { Vat c_vat = new Vat(); RawTCPClient client = new RawTCPClient(c_vat); Log.root.level(log.Level.Warn, true); client.setDataHandler( (char[] inbuf, Dispatcher d) { Stdout(inbuf)(); }); c_vat.run(); client.connect(new IPv4Address("localhost", 5555)); while(true) { char buf[] = Cin.copyln(true); client.send(buf); } return 0; }