Planeshift
sockwin.h
Go to the documentation of this file.
1
2
#ifndef __SOCKWIN_H__
3
#define __SOCKWIN_H__
4
5
//#include <windows.h>
6
#ifdef __CYGWIN__
7
// this avoid a warning in cygwin, we don't have to care about because we don't
8
// use the FD_SET type macors
9
#define USE_SYS_TYPES_FD_SET
10
#endif
11
12
// Do not link in windows
13
#define _INC_WINDOWS
14
#include <winsock.h>
15
#undef _INC_WINDOWS
16
17
22
// INET_ADDRSTRLEN is defined in the ws2ipdef.h file for windows part of winsock 2.
23
// Until that is included we need to include it her.
24
#ifndef INET_ADDRSTRLEN
25
#define INET_ADDRSTRLEN 22
26
#endif
27
28
#define SOCK_SENDTO(a,b,c,d,e,f) sendto(a,(const char *)b,c,d,e,f)
29
#define SOCK_RECVFROM(a,b,c,d,e,f) recvfrom(a,(char *)b,c,d,e,f)
30
#define SOCK_IOCTL(a,b,c) ioctlsocket(a,b,(unsigned long *)c)
31
#define SOCK_CLOSE(a) closesocket(a)
32
#define SOCK_SELECT(max,read,write,except,timeout) select(max,read,write,except,timeout)
33
34
// hack, because on cygwin socklen_t is defined but not suitable for winsock
35
#ifdef socklen_t
36
#undef socklen_t
37
#endif
38
#define socklen_t int
39
40
static
inline
int
initSocket
()
41
{
42
WSADATA wsaData;
43
WORD wVers = MAKEWORD(1, 1);
44
return
WSAStartup(wVers, &wsaData);
45
}
46
47
static
inline
void
exitSocket
()
48
{
49
WSACleanup();
50
}
51
54
#endif
55
initSocket
static int initSocket()
Definition:
sockwin.h:40
exitSocket
static void exitSocket()
Definition:
sockwin.h:47
common
net
sockwin.h
Generated on Sat Jun 19 2021 05:00:30 for Planeshift by
1.8.11