Fixed 2 occourances of -1 insted of 0 causing a small issue.
This commit is contained in:
@@ -23,6 +23,11 @@
|
|||||||
#define SOCKET_ERROR -1
|
#define SOCKET_ERROR -1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//There are cases where 0 isn't a proper socket
|
||||||
|
#if !defined(SOCKET_NONE)
|
||||||
|
#define SOCKET_NONE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(INVALID_SOCKET)
|
#if !defined(INVALID_SOCKET)
|
||||||
#define INVALID_SOCKET -1
|
#define INVALID_SOCKET -1
|
||||||
#endif
|
#endif
|
||||||
@@ -55,7 +60,7 @@ EzSockets::~EzSockets()
|
|||||||
//Check to see if the socket has been created
|
//Check to see if the socket has been created
|
||||||
bool EzSockets::check()
|
bool EzSockets::check()
|
||||||
{
|
{
|
||||||
return sock != INVALID_SOCKET;
|
return sock > SOCKET_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EzSockets::create()
|
bool EzSockets::create()
|
||||||
@@ -89,7 +94,7 @@ bool EzSockets::create(int Protocol, int Type)
|
|||||||
state = skDISCONNECTED;
|
state = skDISCONNECTED;
|
||||||
sock = socket(AF_INET, Type, Protocol);
|
sock = socket(AF_INET, Type, Protocol);
|
||||||
lastCode = sock;
|
lastCode = sock;
|
||||||
return sock != INVALID_SOCKET;
|
return sock > SOCKET_NONE; //Socket must be Greater than 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +147,7 @@ bool EzSockets::accept(EzSockets& socket)
|
|||||||
|
|
||||||
lastCode = socket.sock;
|
lastCode = socket.sock;
|
||||||
|
|
||||||
if (socket.sock == INVALID_SOCKET)
|
if ( socket.sock == SOCKET_ERROR )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
socket.state = skCONNECTED;
|
socket.state = skCONNECTED;
|
||||||
|
|||||||
Reference in New Issue
Block a user