Mercurial > projects > dreactor
comparison test/test.d @ 5:f875a1f278b8
housekeeping
author | rick@minifunk |
---|---|
date | Tue, 08 Jul 2008 12:16:07 -0400 |
parents | f8b01c9f7114 |
children | 287ba7de97c4 |
comparison
equal
deleted
inserted
replaced
4:f8b01c9f7114 | 5:f875a1f278b8 |
---|---|
1 module test; | 1 module test; |
2 | 2 |
3 import tango.net.Socket; | 3 import tango.net.Socket; |
4 import tango.core.Thread; | 4 import tango.core.Thread; |
5 import tango.io.Stdout; | 5 import tango.io.Stdout; |
6 import dreactor.core.SelectLoop; | 6 import dreactor.core.Vat; |
7 import dreactor.core.ConnectionHandler; | 7 import dreactor.core.ConnectionHandler; |
8 import dreactor.protocol.RawTcp; | 8 import dreactor.protocol.RawTcp; |
9 import dreactor.transport.AsyncSocketConduit; | 9 import dreactor.transport.AsyncSocketConduit; |
10 | 10 |
11 int main() | 11 int main() |
12 { | 12 { |
13 AsyncSocketConduit cond = new AsyncSocketConduit; | 13 AsyncSocketConduit cond = new AsyncSocketConduit; |
14 ConnectionHandler lh = new ConnectionHandler(cond, true); | 14 ConnectionHandler lh = new ConnectionHandler(cond, true); |
15 SelectLoop l_loop = new SelectLoop(); | 15 Vat l_vat = new Vat(); |
16 RawTCPListener listener = new RawTCPListener(lh, l_loop, new IPv4Address(5555)); | 16 RawTCPListener listener = new RawTCPListener(lh, l_vat, new IPv4Address(5555)); |
17 l_loop.run(); | 17 l_vat.run(); |
18 | 18 |
19 AsyncSocketConduit clcond = new AsyncSocketConduit; | 19 AsyncSocketConduit clcond = new AsyncSocketConduit; |
20 ConnectionHandler ch = new ConnectionHandler(clcond); | 20 ConnectionHandler ch = new ConnectionHandler(clcond); |
21 SelectLoop c_loop = new SelectLoop(); | 21 Vat c_vat = new Vat(); |
22 RawTCPClient client = new RawTCPClient(ch, c_loop); | 22 RawTCPClient client = new RawTCPClient(ch, c_vat); |
23 c_loop.run(); | 23 c_vat.run(); |
24 | 24 |
25 client.connect(new IPv4Address("localhost", 5555)); | 25 client.connect(new IPv4Address("localhost", 5555)); |
26 //Thread.sleep(1); | 26 //Thread.sleep(1); |
27 client.send("This is a test"); | 27 client.send("This is a test"); |
28 return 0; | 28 return 0; |