X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b8a24f4bc03d6ae054db7fd55887207ae8da9ab7..bc0a5dc216778e8596a60177e35f13fdc429fcb1:/examples/ping/ping.c diff --git a/examples/ping/ping.c b/examples/ping/ping.c index d43603b977..5724135eaa 100644 --- a/examples/ping/ping.c +++ b/examples/ping/ping.c @@ -116,20 +116,17 @@ int server (int argc,char *argv[]) { gras_socket_my_port(g->sock)); g->endcondition=0; - while (1) { - errcode = gras_msg_handle(10.0); - if (errcode != no_error && errcode != timeout_error) - return errcode; - if (g->endcondition) - break; - } + errcode = gras_msg_handle(600.0); + if (errcode != no_error) + return errcode; + if (g->endcondition) if (!gras_if_RL()) gras_sleep(5,0); - INFO0("SERVER: Done."); gras_socket_close(g->sock); free(g); gras_exit(); + INFO0("SERVER: Done."); return no_error; } @@ -164,7 +161,7 @@ int client(int argc,char *argv[]) { port=atoi(argv[2]); } - fprintf(stderr,"Launch client (server on %s:%d)",host,port); + INFO2("Launch client (server on %s:%d)",host,port); if (!gras_if_RL()) gras_sleep(5,0); /* Wait for the server to be setup */ if ((errcode=gras_socket_client(host,port,&(g->sock)))) { @@ -208,6 +205,7 @@ int client(int argc,char *argv[]) { gras_socket_close(g->sock); free(g); + gras_exit(); INFO0("Client: Done."); return 0; }