4
|
1 module test;
|
|
2
|
|
3 import tango.net.Socket;
|
|
4 import tango.core.Thread;
|
|
5 import tango.io.Stdout;
|
5
|
6 import dreactor.core.Vat;
|
4
|
7 import dreactor.core.ConnectionHandler;
|
|
8 import dreactor.protocol.RawTcp;
|
|
9 import dreactor.transport.AsyncSocketConduit;
|
|
10
|
|
11 int main()
|
|
12 {
|
|
13 AsyncSocketConduit cond = new AsyncSocketConduit;
|
|
14 ConnectionHandler lh = new ConnectionHandler(cond, true);
|
5
|
15 Vat l_vat = new Vat();
|
|
16 RawTCPListener listener = new RawTCPListener(lh, l_vat, new IPv4Address(5555));
|
|
17 l_vat.run();
|
4
|
18
|
|
19 AsyncSocketConduit clcond = new AsyncSocketConduit;
|
|
20 ConnectionHandler ch = new ConnectionHandler(clcond);
|
5
|
21 Vat c_vat = new Vat();
|
|
22 RawTCPClient client = new RawTCPClient(ch, c_vat);
|
|
23 c_vat.run();
|
4
|
24
|
|
25 client.connect(new IPv4Address("localhost", 5555));
|
|
26 //Thread.sleep(1);
|
|
27 client.send("This is a test");
|
|
28 return 0;
|
|
29 }
|
|
30
|