diff 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 diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/chatclient.d	Wed Jul 09 00:32:11 2008 -0400
@@ -0,0 +1,35 @@
+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;
+}
+