From caae36ed9a00402c0051b9b6bbf0c744df24ac3e Mon Sep 17 00:00:00 2001 From: MASCARO LUCAS Date: Wed, 22 Feb 2017 12:35:41 +0100 Subject: [PATCH] sa march bitch --- RPC/server.c | 23 +++++++++++++++++++---- RPC/server.h | 2 +- client.c | 41 ++++++++++++++++++++++++++--------------- client.o | Bin 6752 -> 7288 bytes lib.o | Bin 11760 -> 11600 bytes makefile | 13 ++++++++----- server.c | 43 ++++--------------------------------------- server.h | 1 + server.o | Bin 9136 -> 8200 bytes 9 files changed, 59 insertions(+), 64 deletions(-) diff --git a/RPC/server.c b/RPC/server.c index 6d8350d..df12c1b 100644 --- a/RPC/server.c +++ b/RPC/server.c @@ -5,11 +5,19 @@ void traiterClient(int socket){ requete req; int nb_octet; int fini=0; + char i = 0; + while(!fini){ - - nb_octet = read(socket,&req,sizeof(req)); + + nb_octet = read(socket,&req,sizeof(requete)); IF_NB_OCTET_BREAK + + if(nb_octet == 0){ + break; + } + + DEBUG&& printf("Request received (operation/size) : (%d/%d)\n",req.type,req.taille); switch(req.type){ @@ -25,12 +33,19 @@ void traiterClient(int socket){ int nb; long res; - nb_octet = read(socket, &nb, sizeof(int)); + DEBUG&& debug("loop","FACTO asked"); + + nb_octet = read(socket,&nb,sizeof(int)); IF_NB_OCTET_BREAK + DEBUG&& printf("%d\n",nb); + res = factoriel(nb); + DEBUG&& debug("loop","Sending result"); nb_octet = write(socket, &res, sizeof(res)); IF_NB_OCTET_BREAK + DEBUG&& printf("done\n"); + break; } @@ -71,7 +86,7 @@ void traiterClient(int socket){ attendu -= nb_octet; } - analyse(donnees,nb_elem,&res); + analyser_donnees(donnees,nb_elem,&res); write(socket, &res, sizeof(res)); free (donnees); diff --git a/RPC/server.h b/RPC/server.h index abadb6f..1a3d5b9 100644 --- a/RPC/server.h +++ b/RPC/server.h @@ -8,7 +8,7 @@ #include "../calculs.h" #include "../lib.h" - #define IF_NB_OCTET_BREAK if(nb_octet == -1){fini = 1; break;} + #define IF_NB_OCTET_BREAK if(nb_octet == -1){DEBUG&& debug("loop","Breaking the loop\n");fini = 1; break;} #define MAX_BUFFER_LENGTH 200 void traiterClient(int socket); diff --git a/client.c b/client.c index 85de852..6bbf5a6 100644 --- a/client.c +++ b/client.c @@ -14,8 +14,10 @@ int main(int argc, char* argv[]){ /* (2) Misc. information */ int bytes; // transfer count - char* to_send = (char*) malloc( BUFSIZE * sizeof(char) ); - char* to_recv = (char*) malloc( BUFSIZE * sizeof(char) ); + char* to_send = (char*) malloc( sizeof(requete)+sizeof(int)+1 ); + long to_recv; + requete request; + int param; /* [2] Manage arguments @@ -51,7 +53,7 @@ int main(int argc, char* argv[]){ - /* [3] Create UPD socket and get target data + /* [3] Create TCP socket and get target data =========================================================*/ sock = xconnect(hostname, port, &server_addr); @@ -62,25 +64,33 @@ int main(int argc, char* argv[]){ } - /* [4] Send message - =========================================================*/ - /* (1) Send message to server */ - bytes = xwrite(sock, to_send); - - /* (2) Check if send succesfully */ + request.type = FACTO; + //size of the request isn't important + request.taille = sizeof(int); + + param = 2; + + memcpy(to_send,&request,sizeof(requete)); + memcpy(to_send+sizeof(requete),¶m,sizeof(int)); + + bytes = write(sock,to_send,sizeof(requete)+sizeof(int)); + + sleep(2); + param = 3; + memcpy(to_send+sizeof(requete),¶m,sizeof(int)); + + bytes = write(sock,to_send,sizeof(requete)+sizeof(int)); + if( bytes == -1 ){ - perror("erreur envoi message"); + perror("erreur envoi requete"); exit(1); } - DEBUG&& printf("*** sent %d bytes\n", bytes); - - /* [5] Wait for response =========================================================*/ /* (1) Wait for response */ - bytes = xread(sock, to_recv, BUFSIZE); + bytes = recv(sock, &to_recv, sizeof(long),0); /* (2) Check if received successfully (and consistently) */ if( bytes == -1 ){ @@ -89,12 +99,13 @@ int main(int argc, char* argv[]){ } /* (4) log */ - printf("*** received : '%s'\n", to_recv); + printf("*** received : '%ld'\n", to_recv); /* [6] Close socket =========================================================*/ close(sock); + printf("Closing socket\n"); return 0; } diff --git a/client.o b/client.o index 9239c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ynI{sH1|6*$NFZh`j@e@Ngwu8P1p{vQ6dIf%%{M;gNd^g5o=L7oR0SxSaOJaWrHvdls4T(pIfWxN{Xk?4P z`FYF;oY(pN0_XMiC4u|%C2)?Lin(LMUNQxDuWar)u9claGUhp>o{H&TOkye5Rk3o( zG<2{21q43+!@rZnOg))Om7RNlhQb7ulf@zUvB1XQheC%%z@CbwOT)wXJ6Eg-KW)U| z_YwGM1HPJ(kdqtCmhm52{?rl$1vn=>pRBKsD)L8BS{6)G_^uv?zdj!^mE)A?9awDI zt#CtG&K-Fjts$J2w;{vzO`KTyh^a{XHv)`0rTkiw$6VVkvfT}xsMB71$Y*)Zn-Iey z?PFdkG31R?KzCzstRlI1t}Yb6mGr@e(Mq=KOj0qQx$-=ko~=6pVt}M z$014ksocket; int thread_index = arguments->index; - strcpy(to_send, "server default response"); + DEBUG&& printf("starting the computation loop\n"); + //Compute client request + traiterClient(datasock); - DEBUG&& debug("thread", "starting thread"); - DEBUG&& printf("success[%d]\n", thread_index); - - /* [2] Wait for data - =========================================================*/ - /* (1) wait/read data */ - bytes = xread(datasock, to_recv, BUFSIZE); - - /* (2) Manage error */ - if( bytes == -1 ){ - perror("erreur reception paquet"); - exit(1); - } - - - // Get client ip - inet_ntop(AF_INET, &(addr_client.sin_addr), client_ip, 20); - - printf("*** received '%s' (%d bytes) from %s:%d\n", to_recv, bytes, client_ip, ntohs(addr_client.sin_port)); - - - - /* [3] Send response - =========================================================*/ - /* (1) Send response */ - bytes = xwrite(datasock, to_send); - - /* (2) Manage error */ - if( bytes == -1 ){ - perror("erreur envoi rĂ©ponse"); - exit(1); - } - - - - /* [4] End process + /* [2] End process =========================================================*/ /* (1) Close data socket */ DEBUG&& debug("thread", "closing socket"); diff --git a/server.h b/server.h index 1dcad0f..69978ed 100644 --- a/server.h +++ b/server.h @@ -15,6 +15,7 @@ #include #include #include + #include "RPC/server.h" #include "lib.h" diff --git a/server.o b/server.o index 390cfc68f8739d331f2f2cd8c21517755b326e20..69bc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