1 #include "wvistreamlist.h"
4 #include "wvstreamclone.h"
5 #include "wvlinkerhack.h"
8 WV_LINK_TO(WvConStream);
12 volatile bool want_to_die =
false;
14 static void signalhandler(
int sig)
16 fprintf(stderr,
"Caught signal %d. Exiting...\n", sig);
27 len = in->read(buf,
sizeof(buf));
29 WvIStreamList::Iter i(*list);
30 for (i.rewind(); i.next(); )
47 log(
"%s: %s\n", name, s->errstr());
56 log(
"Creating stream: '%s'\n", mon);
59 died(log, _mon, s.
addRef());
62 s->setcallback(wv::bind(bounce_to_list, s.get(), &list));
65 list.append(s.
addRef(),
true, _mon);
69 int main(
int argc,
char **argv)
72 WvLog log(argv[0], WvLog::Debug);
74 signal(SIGTERM, signalhandler);
75 signal(SIGINT, signalhandler);
79 fprintf(stderr,
"Usage: %s <stream1> [stream2 [stream3...]]\n",
87 for (
int count = 1; count < argc; count++)
88 add(log, list, argv[count]);
90 while (!want_to_die && list.count() >= 2)
void runonce(time_t msec_timeout=-1)
Exactly the same as: if (select(timeout)) callback();.
virtual int geterr() const
If isok() is false, return the system error number corresponding to the error, -1 for a special error...
WvTCPConn tries to make all outgoing connections asynchronously (in the background).
WvString is an implementation of a simple and efficient printable-string class.
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
PWvStream is a smart pointer to an IWvStream object.
virtual bool isok() const =0
By default, returns true if geterr() == 0.
virtual IWvStreamCallback setclosecallback(IWvStreamCallback _callfunc)=0
Sets a callback to be invoked on close().
WvStreamList holds a list of WvStream objects – and its select() and callback() functions know how to...
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
virtual unsigned int addRef()=0
Indicate you are using this object.