PlatformSockets.h
00001 
00002 
00003 
00004 
00005 
00006 #pragma once
00007 #include <string>
00008 #include "../base/Types.h"
00009 
00010 
00011 
00012 #if defined(WIN32) // msvc - 32 bit
00013 
00014 #include <Winsock2.h>
00015 #undef SetPort //wow
00016 
00017 typedef int socklen_t;
00018 
00019 #elif defined(linux)  // g++ - 32 bit
00020 
00021 #include <sys/socket.h>
00022 #include <arpa/inet.h>
00023 #include <netdb.h>
00024 #include <netinet/tcp.h>
00025 
00026 #else // ?
00027 
00028     #error Unknown platform in PlatformSockets.h
00029 
00030 #endif
00031 
00032 
00033 
00034 namespace NET_INTERNAL
00035 {
00036     
00037     bool Internal_SetSocketBlocking(int sock, bool block);
00038 
00039     
00040     void Internal_ClearLastError();
00041 
00042     
00043     std::string Internal_GetLastError();
00044 
00045     
00046     void Internal_CloseSocket(int sock);
00047 
00048     
00049     bool Internal_IsLastSocketErrorADisconnect();
00050 
00051     
00052     bool Internal_GetSubnet(uint32 &mask, uint32 &net, uint32 &localIp);
00053 }