Código
DWORD WINAPI keepalive(LPVOID){ char KEEP_ALIVE = '\0'; while(1){ if(send(cnn, &KEEP_ALIVE, sizeof(char), 0) == SOCKET_ERROR){ TerminateThread(hiloRecibir, 0); hiloCnn = CreateThread(NULL, 0, esperarCnn, 0, 0, 0); printf("WINSOCK: Desconectado.\n"); ExitThread(0); } Sleep(2500); } }
EDIT:
En Windows XP funciona perfectamente.