1#include "wvunixdgsocket.h"
7WvUnixDGSocket::WvUnixDGSocket(
WvStringParm filename,
bool _server,
int perms)
17 setfd(socket(PF_UNIX, SOCK_DGRAM, 0));
22 seterr(
"No Socket available.");
27 fcntl(getfd(), F_SETFL, O_RDWR|O_NONBLOCK);
34 setsockopt(getfd(), SOL_SOCKET, SO_REUSEADDR, &x,
sizeof(x));
42 sockaddr *addr = uaddr.sockaddr();
43 if (bind(getfd(), (sockaddr *)addr, uaddr.sockaddr_len()))
45 seterr(
"Bind to %s failed: %s", socketfile, strerror(errno));
50 chmod(socketfile, perms);
55 sockaddr *addr = uaddr.sockaddr();
56 if (connect(getfd(), (sockaddr *)addr, uaddr.sockaddr_len()))
58 seterr(
"Connect to %s failed: %s",
59 socketfile, strerror(errno));
68WvUnixDGSocket::~WvUnixDGSocket()
103 si.wants.writable =
true;
104 else if (si.msec_timeout < 0
118 si.wants.writable =
true;
127 WvBufList::Iter i(bufs);
128 for (i.rewind(); i.next(); )
130 int used = i->used();
void put(const T *data, size_t count)
Writes the specified number of elements from the specified storage location into the buffer at its ta...
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
virtual void close()
Closes the file descriptors.
virtual bool post_select(SelectInfo &si)
post_select() is called after select(), and returns true if this object is now ready.
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling select().
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
void alarm(time_t msec_timeout)
set an alarm, ie.
time_t alarm_remaining()
return the number of milliseconds remaining before the alarm will go off; -1 means no alarm is set (i...
A Unix domain socket address is really just a filename.
virtual size_t uwrite(const void *buf, size_t count)
unbuffered I/O functions; these ignore the buffer, which is handled by write().
virtual bool post_select(SelectInfo &si)
post_select() is called after select(), and returns true if this object is now ready.
virtual void pre_select(SelectInfo &si)
pre_select() sets up for eventually calling select().
the data structure used by pre_select()/post_select() and internally by select().
A SelectRequest is a convenient way to remember what we want to do to a particular stream: read from ...