diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-29 20:28:19 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-29 20:28:19 +0100 |
commit | 89afb970d88e3efa8ddb2f1eafff10cd6525f2b7 (patch) | |
tree | 206b3ba15c0fc87b3bf9ad7371f73887280945c4 /source/MCSocket.h | |
parent | VC2008 compilation with new lua webplugin (diff) | |
download | cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.tar cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.tar.gz cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.tar.bz2 cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.tar.lz cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.tar.xz cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.tar.zst cuberite-89afb970d88e3efa8ddb2f1eafff10cd6525f2b7.zip |
Diffstat (limited to 'source/MCSocket.h')
-rw-r--r-- | source/MCSocket.h | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/source/MCSocket.h b/source/MCSocket.h index 5dda6c5a3..30aa20bdd 100644 --- a/source/MCSocket.h +++ b/source/MCSocket.h @@ -1,36 +1,29 @@ #pragma once -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include <Windows.h> -#include <WinSock.h> -// #define socklen_t int -// #ifdef SendMessage -// #undef SendMessage -// #endif -#else +#ifndef _WIN32 + // Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html + #include <netdb.h> + #include <sys/socket.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <unistd.h> + + // TODO: We shouldn't need these! Use the OS support objects instead + #define SOCKET int + typedef void *HANDLE; + #define CRITICAL_SECTION pthread_mutex_t + #define SD_BOTH (2) + #define closesocket(x) (shutdown(x, SD_BOTH), close(x)) + #define SOCKET_ERROR SO_ERROR + #define EnterCriticalSection(x) pthread_mutex_lock(x) + #define LeaveCriticalSection(x) pthread_mutex_unlock(x) + #define InitializeCriticalSection(x) pthread_mutex_init(x, NULL) + #define DeleteCriticalSection(x) (x) +#endif + -// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html -#include <netdb.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <pthread.h> -#include <unistd.h> -#define SOCKET int -typedef void *HANDLE; -#define CRITICAL_SECTION pthread_mutex_t -#define SD_BOTH (2) -#define closesocket(x) (shutdown(x, SD_BOTH), close(x)) -#define SOCKET_ERROR SO_ERROR -#define EnterCriticalSection(x) pthread_mutex_lock(x) -#define LeaveCriticalSection(x) pthread_mutex_unlock(x) -#define InitializeCriticalSection(x) pthread_mutex_init(x, NULL) -#define DeleteCriticalSection(x) (x) -#define sprintf_s(x, y, ...) sprintf(x, __VA_ARGS__) -#endif inline bool IsSocketError( int a_ReturnedValue ) { |