13 #include <sys/types.h>
16 #ifdef HAVE_SYS_SOCKET_H
17 #include <sys/socket.h>
33 read_cb(
int fd,
short event,
void *arg)
38 len = read(fd, buf,
sizeof(buf));
40 printf(
"%s: read %d%s\n", __func__,
41 len, len ?
"" :
" - means EOF");
46 }
else if (called == 1)
57 main (
int argc,
char **argv)
60 const char *
test =
"test string";
63 if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)
67 write(pair[0], test, strlen(test)+1);
68 shutdown(pair[0], SHUT_WR);
74 event_set(&ev, pair[1], EV_READ, read_cb, &ev);