1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| DWORD _createSocketThread(){
WSAStartup();
...
...
if (connect(...))...
while (true){
if (recv(s,buf,sizeof buf,0) > 0) {
//fonction de reception des strings venant du serveur...
fonctionReadSocket(buf); // read
...
}
...
}
...
}
//le prob
void fonctionReadSocket(char buf[2048]){
//char to string.
if (monString == "process"){
DWORD ThreadID = 0;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)_SendProcessData, (LPVOID)&testTableau, 0, &ThreadID);
}
}
void entryPoint(){
DWORD SockThreadID = 0;
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)_createSocketThread, 0, 0, &SockThreadID); // Je lance le thread principal de connexion au server et reception des commandes.
} |
Partager