What's wrong with this code?
I can't understand what I'm doing wrong, here is the server code and part of the client code.
Server:
Code:
SOCKET TempSocket = SOCKET_ERROR; // Set the TempSocket to error //
while(TempSocket = SOCKET_ERROR)
{
TempSocket = accept(Socket, NULL, NULL);
}
Socket = TempSocket;
Client:
Code:
if(connect(Socket, (SOCKADDR*)(&SockAddr), sizeof(SockAddr)) != 0)
{
SetConsoleTextAttribute(houtput, BACKGROUND_RED|BACKGROUND_INTENSITY);
status = GetLastError();
cout << "" << endl;
cout << "Failed to establish connection with the server" << endl;
cout << "Application error code: " << status << endl;
hinput = NULL;
houtput = NULL;
herror = NULL;
Sleep(10000);
return;
}