nitlog: oops, didn't deal properly with posts in months that haven't
[wvapps.git] / wvsync / tests / protocol_client.cc
blob013e8de3a3f7cf223479885666cc1b4b9be14261
1 #include "wvstream.h"
2 #include "wvistreamlist.h"
3 #include "wvsyncstring.h"
4 #include "wvsyncarbiter.h"
5 #include "wvsyncprotocol.h"
6 #include "uniconfroot.h"
7 #include "wvtcp.h"
9 int main()
11 WvLog log("Test Client", WvLog::Info);
12 UniConfRoot root("ini:/tmp/wvsync_client.ini");
14 WvTCPConn tcp((WvIPPortAddr)"127.0.0.1:4321");
15 WvSyncArbiter wsa;
16 WvSyncProtocol proto(&tcp, &log, wsa, root, false);
18 WvSyncString *obj = new
19 WvSyncString("ashley", "I have but a fleeting memory of thee", 10);
20 // while (!proto.want_more())
21 // {
22 // log(WvLog::Info, "More, more, give me more\n");
23 // proto.runonce();
24 // }
25 proto.do_chdir("foo");
26 // while (!proto.want_more())
27 // proto.runonce();
28 proto.do_ihave(obj);
30 WvIStreamList::globallist.append(&proto, false);
32 while (!WvIStreamList::globallist.isempty())
33 WvIStreamList::globallist.runonce();
35 while (proto.isok() && tcp.isok())
37 log(WvLog::Debug4, "select\n");
38 proto.runonce();
39 }*/
41 #if 0
42 log("CHDIR\n");
43 wvcon->print("CHDIR foo\n");
45 log("IHAVE\n");
46 wvcon->print("IHAVE new none 1192347202 i_am_some_meta ashley\n");
48 log("SIG\n");
49 WvSyncString ash("ashley", "She is out there somewhere,"
50 " but I missed my chance.\n");
51 WvDynBuf buf;
52 buf.zap();
53 ash.getsig(buf);
54 size_t size = buf.used();
55 wvcon->print("OK\n");
57 WvDynBuf sig;
58 // log("Read %s bytes\n", wvcon->read(sig, 24));
59 // wvcon->print("SIG %s ashley\n", size);
60 // wvcon->flush(5000);
61 sleep(5);
62 // log("Wrote %s bytes\n", wvcon->write(buf, size));
64 wvcon->autoforward(*wvcon);
65 while (wvcon->isok())
66 wvcon->runonce();
67 #endif
69 return 0;