- /* wait to ensure that all server sockets are there before starting the experiment */
- gras_os_sleep(0.5);
-
- peer = gras_socket_client(argv[1],atoi(argv[2]));
-
- INFO0("Test the BW between me and one of the sensors");
- amok_bw_test(peer,buf_size,exp_size,msg_size,&sec,&bw);
- INFO6("Experience between me and %s:%d (%d kb in msgs of %d kb) took %f sec, achieving %f kb/s",
- argv[1],atoi(argv[2]),
- exp_size,msg_size,
- sec,bw);
-
- INFO0("Test the BW between the two sensors");
- amok_bw_request(argv[1],atoi(argv[2]),argv[3],atoi(argv[4]),
- buf_size,exp_size,msg_size,&sec,&bw);
- INFO2("Experience took took %f sec, achieving %f kb/s",
- sec,bw);
-
- /* ask sensors to quit */
- gras_msgtype_declare("quit",NULL);
- gras_msg_send(peer,gras_msgtype_by_name("quit"), NULL);
- gras_socket_close(peer);
-
- peer = gras_socket_client(argv[3],atoi(argv[4]));
- gras_msg_send(peer,gras_msgtype_by_name("quit"), NULL);
- gras_socket_close(peer);
-
- gras_socket_close(g->sock);
+ XBT_INFO("Contact %s:%d", h1->name, h1->port);
+ peer = gras_socket_client(h1->name, h1->port);
+
+ XBT_INFO("Test the BW between me and one of the sensors");
+ amok_bw_test(peer, buf_size, msg_size, msg_amount, min_duration, &sec,
+ &bw);
+ XBT_INFO
+ ("Experience between me and %s:%d (initially %d msgs of %d bytes, maybe modified to fill the pipe at least %.1fs) took %f sec, achieving %f kb/s",
+ h1->name, h1->port, msg_amount, msg_size, min_duration, sec,
+ ((double) bw) / 1024.0);
+
+ XBT_INFO("Test the BW between %s:%d and %s:%d", h1->name, h1->port,
+ h2->name, h2->port);
+ amok_bw_request(h1->name, h1->port, h2->name, h2->port, buf_size,
+ msg_size, msg_amount, min_duration, &sec, &bw);
+ XBT_INFO
+ ("Experience between %s:%d and %s:%d took took %f sec, achieving %f kb/s",
+ h1->name, h1->port, h2->name, h2->port, sec,
+ ((double) bw) / 1024.0);
+
+ /* Game is over, friends */
+ amok_pm_group_shutdown("bandwidth");
+
+ gras_socket_close(mysock);
+ gras_exit();