9#include "wvistreamlist.h"
13int main(
int argc,
char **argv)
15 WvLog err(
"udp", WvLog::Error);
17 WvIPPortAddr remaddr(argc > 1 ? argv[1] :
"127.0.0.1:19");
20 sock.enable_broadcasts();
22 err(WvLog::Info,
"Local address is %s.\n", *sock.local());
24 wvcon->autoforward(sock);
25 sock.autoforward(err);
28 l.add_after(l.tail, wvcon,
false);
29 l.add_after(l.tail, &sock,
false);
31 while (wvcon->isok() && sock.isok())
33 sock.setdest(remaddr);
38 else if (sock.select(0))
41 err(WvLog::Info,
" (remote: %s)\n", *sock.src());
46 if (!wvcon->isok() && wvcon->geterr())
47 err(
"stdin: %s\n", strerror(wvcon->geterr()));
48 else if (!sock.isok() && sock.geterr())
49 err(
"socket: %s\n", strerror(sock.geterr()));
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
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.
WvUDPStream can send and receive packets on a connectionless UDP socket.