Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

wvloopback.cc

Go to the documentation of this file.
00001 /*
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * Implementation of the WvLoopback stream.  WvLoopback uses a
00006  * socketpair() to create a stream that allows you to read()
00007  * everything written to it, even (especially) across a fork() call.
00008  */
00009 #include "wvloopback.h"
00010 #include <sys/socket.h>
00011 #include <fcntl.h>
00012 
00013 WvLoopback::WvLoopback()
00014 {
00015     int socks[2];
00016     
00017     if (socketpair(AF_UNIX, SOCK_STREAM, 0, socks))
00018     {
00019         errnum = errno;
00020         return;
00021     }
00022     
00023     rfd = socks[0];
00024     wfd = socks[1];
00025 
00026     fcntl(rfd, F_SETFD, 1);
00027     fcntl(rfd, F_SETFL, O_RDONLY|O_NONBLOCK);
00028     fcntl(wfd, F_SETFD, 1);
00029     fcntl(wfd, F_SETFL, O_WRONLY|O_NONBLOCK);
00030 }

Generated on Sat Aug 24 21:09:35 2002 for WvStreams by doxygen1.2.15