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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| while(1){
sconnexion = connexion(ssocket);
//printf(" %s ", cli[i-1]);
//if(pid!=0){/*traitement de la connexion*/
memset(idclient,0,sizeof(idclient));
memset(identif,0,sizeof(identif));
memset(string,0,sizeof(string));
write(sconnexion , IRCA, strlen(IRCA));
read(sconnexion , idclient, sizeof(idclient));
longeur = strlen(idclient);
strncpy(identif, idclient,longeur-1);
verif = verification(identifiant,identif);
if(verif == 0){
memset(idclient,0,sizeof(idclient));
memset(identif,0,sizeof(identif));
memset(string,0,sizeof(string));
write(sconnexion , IRCD, strlen(IRCD));
read(sconnexion , idclient, sizeof(idclient));
longeur = strlen(idclient);
while(longeur > 6){
memset(idclient,0,sizeof(idclient));
write(sconnexion , IRCB, strlen(IRCB));
read(sconnexion , idclient, sizeof(idclient));
longeur = strlen(idclient);
}
strncpy(identif, idclient,longeur-1);
sprintf(string,"%d@%s",sconnexion, identif);
sprintf(bonjour,"Bonjour %s! ", identif);
/*strcpy(cli[i],identif);
for(j=0; j<=i; j++){
printf(" %s ", cli[j]);
}
printf("\n");*/
enfiler (identifiant, identifiant->fin, identif);
printf("%s est 1 %d\n", file_donnee(identifiant), sconnexion );
enfiler (client, client->fin, string);
printf("%s est %d\n", file_donnee(client), sconnexion);
write(sconnexion , bonjour, strlen(bonjour));
//read(sconnexion , idclient, sizeof(idclient));
//printf("0\n");
write(sconnexion , IRCC, strlen(IRCC));
//printf("1\n");
affiche(identifiant);
//printf("2\n");
affiche(client);
/*printf("3\n");
printf(" %s ", cli[i]);
i++;*/
}
//else{
//}
//}
//if(pid==0){/*traitement de la méssagerie*/
//}
} |
Partager