1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| /**********La prcédure**********/
void acceptation(HWND dlg, CLIENT cl)
{
if(cl.statut==0) {
sinsize = sizeof(cl.csin);
if((cl.socket = accept(sock, (SOCKADDR *)&cl.csin, &sinsize)) != INVALID_SOCKET) {
sprintf(buffer,"%cC%c",255,1);
send(cl.socket,buffer,530,0);
SetDlgItemText(dlg,120+cl.num,"Occupé");
cl.statut=1; /***quant je teste "cl.statut" est à 1***/
}
}
}
/**********Appel de la prcédure (dans le programme)**********/
acceptation(hDlg,client1); /*** client1.statut ne veut pas passer à 1 losrque qu'un client se connecte (quant il se connecte client1 biensur)***/
acceptation(hDlg,client2);/***idem***/
acceptation(hDlg,client3);/***idem***/
acceptation(hDlg,client4);/***idem***/ |
Partager