mysock = gras_socket_server_range(3000,9999,0,0);
INFO1("Sensor starting (on port %d)",gras_os_myport());
mysock = gras_socket_server_range(3000,9999,0,0);
INFO1("Sensor starting (on port %d)",gras_os_myport());
- gras_os_sleep(0.5); /* let the master get ready */
- master = gras_socket_client_from_string(argv[1]);
+ while (connection_try > 0 && master == NULL) {
+ int connected = 0;
+ TRY {
+ master = gras_socket_client_from_string(argv[1]);
+ connected = 1;
+ } CATCH(e) {
+ xbt_ex_free(e);
+ }
+ if (!connected) {
+ connection_try--;
+ gras_os_sleep(0.5); /* let the master get ready */
+ }
+ }
INFO2("Contact %s:%d",h1->name, h1->port);
peer = gras_socket_client(h1->name, h1->port);
INFO2("Contact %s:%d",h1->name, h1->port);
peer = gras_socket_client(h1->name, h1->port);