WvStreams
wvsocketpair.cc
1/*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * Implementation of wvsocketpair(), a portable way to call socketpair().
6 */
7#include "wvsocketpair.h"
8#include <fcntl.h>
9
10#ifndef _WIN32
11# include <sys/socket.h>
12#else
13# include <winsock2.h>
14#endif
15
16#ifdef _WIN32
17int socketpair(int family, int type, int protocol, int *sb);
18#endif
19
20int wvsocketpair(int type, int socks[2])
21{
22 // NOTE: a fake socketpair() call is provided by wvstreams for win32.
23 // The main advantage of wvsocketpair is it avoids the weird mess of
24 // includes, ifdefs, and prototypes above.
25 return socketpair(PF_UNIX, type, 0, socks);
26}