File: wvsocketpair.cc

package info (click to toggle)
wvstreams 4.6.1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 6,820 kB
  • ctags: 7,837
  • sloc: cpp: 64,203; ansic: 4,154; sh: 4,094; makefile: 549; perl: 402
file content (26 lines) | stat: -rw-r--r-- 675 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Worldvisions Weaver Software:
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
 * 
 * Implementation of wvsocketpair(), a portable way to call socketpair().
 */
#include "wvsocketpair.h"
#include <fcntl.h>

#ifndef _WIN32
# include <sys/socket.h>
#else
# include <winsock2.h>
#endif

#ifdef _WIN32
int socketpair(int family, int type, int protocol, int *sb);
#endif

int wvsocketpair(int type, int socks[2])
{
    // NOTE: a fake socketpair() call is provided by wvstreams for win32.
    // The main advantage of wvsocketpair is it avoids the weird mess of
    // includes, ifdefs, and prototypes above.
    return socketpair(PF_UNIX, type, 0, socks);
}