18 #include "wvistreamlist.h"
23 int main(
int argc,
char **argv)
25 WvLog log(
"http", WvLog::Info);
26 WvURL url(
"http://www.net-itech.com/");
27 WvHTTPStream http(url);
28 WvFile out(
"http.out", O_WRONLY | O_TRUNC | O_CREAT);
29 WvHTTPStream::State last_state = WvHTTPStream::Done;
30 static char buf[10240];
34 l.add_after(l.tail, &http,
false);
36 while (http.isok() && out.isok())
38 if (last_state != http.state)
40 log(
"\nNow in state %s\n", http.state);
41 last_state = http.state;
49 len = http.read(buf,
sizeof(buf));
55 if (!http.isok() && http.geterr())
56 log(
"http: %s\n", http.errstr());
WvFile implements a stream connected to a file or Unix device.
WvStreamList holds a list of WvStream objects – and its select() and callback() functions know how to...
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
bool select(time_t msec_timeout)
Return true if any of the requested features are true on the stream.
virtual void callback()
if the stream has a callback function defined, call it now.