Commit e8396a6b authored by pernelle's avatar pernelle
Browse files

Merge tag '2020.1.2' into develop

Finish 2020.1.2
parents 0a158e08 df7e8df1
......@@ -174,23 +174,16 @@ int connexionServeurCOL3(const char *adresse_serveur,int port, const char *token
*/
void envoiMessageCOL3(int sock, const char * msgresponse) {
if (send(sock, msgresponse, strlen(msgresponse), 0) < 0) {
if (!NCURSE) printf("%s %s %s"," --> socket[lireMessageCOL3] : envoi msg = {",msgresponse,"} [NOK] \n");
if (!NCURSE) printf("%s %s %s"," --> socket[envoiMessageCOL3] : envoi msg = {",msgresponse,"} [NOK] \n");
}
else {
if (!NCURSE) printf("%s %s %s"," --> socket[lireMessageCOL3] : envoi msg = {",msgresponse,"} [OK]\n");
if (!NCURSE) printf("%s %s %s"," --> socket[envoiMessageCOL3] : envoi msg = {",msgresponse,"} [OK]\n");
}
}
/**
cette fonction envoi une structure (mastructure) par la socket (sock)
......@@ -198,10 +191,10 @@ void envoiMessageCOL3(int sock, const char * msgresponse) {
*/
void envoiStructureCOL3(int sock, void * mastructure,int taille) {
if (send(sock, (char *) mastructure, taille, 0) < 0) {
perror("envoi message [NOK]");
if (!NCURSE) printf("%s"," --> socket[envoiStructureCOL3] : envoi [NOK] \n");
}
else {
if (!NCURSE) printf("%s %d %s","--> envoi stucture de taille =",taille,"\n");
if (!NCURSE) printf("%s %d %s"," --> socket[envoiStructureCOL3] : envoi taille = ",taille," [OK]\n");
}
}
......@@ -228,14 +221,18 @@ void lireMessageCOL3(int sock, char * msgrecu) {
if (!NCURSE) printf("%s %d %s"," --> socket[lireMessageCOL3] : en attente reception message (MAX=",TAILLE_MAX_MSG,") ...\n");
/* attente en reception d'un message emis par le serveur */
if((nbrecu = recv(sock, temp, sizeof(temp), 0)) < 0) {
if (!NCURSE) printf("%s"," --> socket[lireMessageCOL3] : reception message [NOK] \n");
}
temp[nbrecu<0 ? 0 : nbrecu] = '\0';
strcpy(msgrecu,temp);
if (!NCURSE) printf("%s %d %s %s %s "," --> socket[lireMessageCOL3] : reception message [OK] : nbrecu = ",nbrecu," msg = {",msgrecu,"}\n");
}
if((nbrecu = recv(sock, temp, sizeof(temp), 0)) <= 0) {
if (!NCURSE) printf("%s %d %s"," --> socket[lireMessageCOL3] : reception message [NOK] : nbrecu = ",nbrecu," \n");
strcpy(msgrecu,"");
}
else
{
temp[nbrecu] = '\0';
strcpy(msgrecu,temp);
if (!NCURSE) printf("%s %d %s %s %s "," --> socket[lireMessageCOL3] : reception message [OK] : nbrecu = ",nbrecu," msg = {",msgrecu,"}\n");
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment