WvStreams
wvsocketpair.cc
00001 /*
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * Implementation of wvsocketpair(), a portable way to call socketpair().
00006  */
00007 #include "wvsocketpair.h"
00008 #include <fcntl.h>
00009 
00010 #ifndef _WIN32
00011 # include <sys/socket.h>
00012 #else
00013 # include <winsock2.h>
00014 #endif
00015 
00016 #ifdef _WIN32
00017 int socketpair(int family, int type, int protocol, int *sb);
00018 #endif
00019 
00020 int wvsocketpair(int type, int socks[2])
00021 {
00022     // NOTE: a fake socketpair() call is provided by wvstreams for win32.
00023     // The main advantage of wvsocketpair is it avoids the weird mess of
00024     // includes, ifdefs, and prototypes above.
00025     return socketpair(PF_UNIX, type, 0, socks);
00026 }