Sockets are started to annoy me now. A SOCKET is just a u_int correct? So why is it that whenever I try to make a SOCKET == another SOCKET, doing operations on it always returns errors, and if I pass them into classes and member functions, they always return errors?
Such as like this:
the function's send function (here) returns -1.
SOCKET newConn = lSocket.Accept();
if (newConn != INVALID_SOCKET)
*StatusLogBox << "Attempted connection located.";
*StatusLogBox << "Receiving Welcome Packet...";
string received = ServerSocket.Receive();
if (received.compare(RKL_INSTALL_DATA) == 0)
*StatusLogBox << "Welcome Packet Received.";
int a = ServerSocket.Send(RKL_ACCEPTED_CONN);
i_Client->AddServer(newConn); //SOCKET is added to a vector as part of a globally declared class instance
*StatusLogBox << "v Connection terminated.";
for (UINT i=0;i<i_Client->GetNumInstalls();i++)
if (i_Client->IsDataWaiting(i)) //Problem
Servers (index==0), is the same newConn accept()ed SOCKET. Still the same number, but it returns -1 and WSAGetLastError() is... 6?
bool Client::IsDataWaiting(UINT index)
bool found = false; //found at least one server with data waiting
SOCKET sv = Servers[index];
if(send(sv,RKL_DATA_WAITING.c_str(),RKL_DATA_WAITING.length(),0) == SOCKET_ERROR)
Specified event object handle is invalid.An application attempts to use an event object, but the specified handle is not valid. Note that this error is returned by the operating system, so the error number may change in future releases of Windows.
I've never seen that and when I looked, all I found was references to WSAWaitForMultipleEvents(), which I am not using. The handle should not have been deleted (although there is no handle so I'm even more confused.)
I am at my last wit. What is up with SOCKETs?