X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ca7838c3440b5dab4545fc2ebdfc52ff0717cf3a..94446121333b0ae1ae6eea3c32124fd4b3df62f2:/examples/gras/all2all/all2all.c diff --git a/examples/gras/all2all/all2all.c b/examples/gras/all2all/all2all.c index d194b62846..e2200e44e6 100644 --- a/examples/gras/all2all/all2all.c +++ b/examples/gras/all2all/all2all.c @@ -28,7 +28,7 @@ int receiver (int argc,char *argv[]) { int myport; /* port on which I receive stuff */ int todo; /* amount of messages I should get */ - int data; /* message content */ + char *data; /* message content */ gras_socket_t mysock; /* socket on which other people contact me */ gras_socket_t expeditor; /* to notice who wrote me */ @@ -44,7 +44,7 @@ int receiver (int argc,char *argv[]) { mysock = gras_socket_server(myport); /* Register the known messages */ - gras_msgtype_declare("data", gras_datadesc_by_name("int")); + gras_msgtype_declare("data", gras_datadesc_by_name("string")); /* Get the data */ @@ -58,16 +58,16 @@ int receiver (int argc,char *argv[]) { &data); todo--; - INFO4("Got Data(%d) from %s:%d (still %d to go)", - data, + INFO3("Got Data from %s:%d (still %d to go)", + /* data,*/ gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor), todo); } - + /* Free the allocated resources, and shut GRAS down */ gras_socket_close(mysock); - + gras_exit(); return 0; } /* end_of_receiver */ @@ -79,11 +79,12 @@ int receiver (int argc,char *argv[]) { int sender (int argc,char *argv[]) { int i; /* iterator */ - int data; /* data exchanged */ - + char *data; /* data exchanged */ + int datasize; /* size of message */ xbt_host_t h; /* iterator */ gras_socket_t peer; /* socket to node */ + /* xbt_dynar for hosts */ xbt_dynar_t hosts = xbt_dynar_new(sizeof(xbt_host_t),&xbt_host_free_voidp); @@ -92,27 +93,33 @@ int sender (int argc,char *argv[]) { gras_init(&argc,argv); /* Get the node location from argc/argv */ - for (i=1; iname,h->port); gras_msg_send(peer,gras_msgtype_by_name("data"),&data); - INFO3(" Sent Data (%d) from %s to %s", - data,gras_os_myname(),h->name); + INFO2(" Sent Data from %s to %s", + /*data,*/gras_os_myname(),h->name); gras_socket_close(peer); }