Mercurial > projects > dreactor
view test/test.d @ 4:f8b01c9f7114
adding basic protocols
author | rick@minifunk |
---|---|
date | Tue, 08 Jul 2008 11:22:39 -0400 |
parents | |
children | f875a1f278b8 |
line wrap: on
line source
module test; import tango.net.Socket; import tango.core.Thread; import tango.io.Stdout; import dreactor.core.SelectLoop; import dreactor.core.ConnectionHandler; import dreactor.protocol.RawTcp; import dreactor.transport.AsyncSocketConduit; int main() { AsyncSocketConduit cond = new AsyncSocketConduit; ConnectionHandler lh = new ConnectionHandler(cond, true); SelectLoop l_loop = new SelectLoop(); RawTCPListener listener = new RawTCPListener(lh, l_loop, new IPv4Address(5555)); l_loop.run(); AsyncSocketConduit clcond = new AsyncSocketConduit; ConnectionHandler ch = new ConnectionHandler(clcond); SelectLoop c_loop = new SelectLoop(); RawTCPClient client = new RawTCPClient(ch, c_loop); c_loop.run(); client.connect(new IPv4Address("localhost", 5555)); //Thread.sleep(1); client.send("This is a test"); return 0; }