remove xbox support; it doesn't work, and it'd take too much effort to get it working again
This commit is contained in:
+6
-41
@@ -10,9 +10,9 @@
|
||||
|
||||
#include "ezsockets.h"
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_XBOX) // We need the WinSock32 Library on Windows
|
||||
#if defined(_MSC_VER) // We need the WinSock32 Library on Windows
|
||||
#pragma comment(lib,"wsock32.lib")
|
||||
#elif !defined(__MINGW32__) && !defined(_XBOX)
|
||||
#elif !defined(__MINGW32__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
@@ -38,7 +38,7 @@ EzSockets::EzSockets()
|
||||
MAXCON = 5;
|
||||
memset (&addr,0,sizeof(addr)); //Clear the sockaddr_in structure
|
||||
|
||||
#if defined(_WINDOWS) || defined(_XBOX) // Windows REQUIRES WinSock Startup
|
||||
#if defined(_WINDOWS) // Windows REQUIRES WinSock Startup
|
||||
WSAStartup( MAKEWORD(1,1), &wsda );
|
||||
#endif
|
||||
|
||||
@@ -61,11 +61,7 @@ EzSockets::~EzSockets()
|
||||
//Check to see if the socket has been created
|
||||
bool EzSockets::check()
|
||||
{
|
||||
#if !defined(XBOX)
|
||||
return sock > SOCKET_NONE;
|
||||
#else
|
||||
return sock != INVALID_SOCKET;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool EzSockets::create()
|
||||
@@ -82,13 +78,7 @@ bool EzSockets::create(int Protocol)
|
||||
case IPPROTO_UDP:
|
||||
return create(IPPROTO_UDP, SOCK_DGRAM);
|
||||
default:
|
||||
/* XBOX does not support raw sockets. So, since there's no need,
|
||||
we aren't going to allow it on the XBOX. */
|
||||
#if defined(_XBOX)
|
||||
return false;
|
||||
#else
|
||||
return create(Protocol, SOCK_RAW);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +87,9 @@ bool EzSockets::create(int Protocol, int Type)
|
||||
state = skDISCONNECTED;
|
||||
sock = socket(AF_INET, Type, Protocol);
|
||||
lastCode = sock;
|
||||
#if !defined(XBOX)
|
||||
return sock > SOCKET_NONE; //Socket must be Greater than 0
|
||||
#else
|
||||
return sock != INVALID_SOCKET;
|
||||
#endif
|
||||
return sock > SOCKET_NONE; // Socket must be Greater than 0
|
||||
}
|
||||
|
||||
|
||||
bool EzSockets::bind(unsigned short port)
|
||||
{
|
||||
if(!check())
|
||||
@@ -184,32 +169,12 @@ bool EzSockets::connect(const std::string& host, unsigned short port)
|
||||
if(!check())
|
||||
return false;
|
||||
|
||||
#if defined(_XBOX)
|
||||
if(!isdigit(host[0])) // don't do a DNS lookup for an IP address
|
||||
{
|
||||
XNDNS *pxndns = NULL;
|
||||
XNetDnsLookup(host.c_str(), NULL, &pxndns);
|
||||
while (pxndns->iStatus == WSAEINPROGRESS)
|
||||
{
|
||||
// Do something else while lookup is in progress
|
||||
}
|
||||
|
||||
if (pxndns->iStatus == 0)
|
||||
memcpy(&addr.sin_addr, &pxndns->aina[0], sizeof(struct in_addr));
|
||||
else
|
||||
return false;
|
||||
|
||||
XNetDnsRelease(pxndns);
|
||||
}
|
||||
else
|
||||
addr.sin_addr.s_addr = inet_addr(host.c_str());
|
||||
#else
|
||||
struct hostent* phe;
|
||||
phe = gethostbyname(host.c_str());
|
||||
if (phe == NULL)
|
||||
return false;
|
||||
memcpy(&addr.sin_addr, phe->h_addr, sizeof(struct in_addr));
|
||||
#endif
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
@@ -266,7 +231,7 @@ void EzSockets::update()
|
||||
|
||||
unsigned long EzSockets::LongFromAddrIn( const sockaddr_in & s )
|
||||
{
|
||||
#if defined(_XBOX) || defined(_WINDOWS)
|
||||
#if defined(_WINDOWS)
|
||||
return ntohl(s.sin_addr.S_un.S_addr);
|
||||
#else
|
||||
return ntohl(s.sin_addr.s_addr);
|
||||
|
||||
Reference in New Issue
Block a user