summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
07a0ce8)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3758
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
int client(int argc,char *argv[]) {
xbt_ex_t e;
gras_socket_t toserver=NULL; /* peer */
int client(int argc,char *argv[]) {
xbt_ex_t e;
gras_socket_t toserver=NULL; /* peer */
gras_socket_t from;
int ping, pong;
gras_socket_t from;
int ping, pong;
gras_os_sleep(1);
/* 4. Create a socket to speak to the server */
gras_os_sleep(1);
/* 4. Create a socket to speak to the server */
- TRY {
- toserver=gras_socket_client(host,port);
- } CATCH(e) {
- RETHROW0("Unable to connect to the server: %s");
+ while (!connected) {
+ TRY {
+ toserver=gras_socket_client(host,port);
+ connected = 1;
+ } CATCH(e) {
+ if (e.category != system_error)
+ /* dunno what happened, let the exception go through */
+ RETHROW0("Unable to connect to the server: %s");
+ xbt_ex_free(e);
+ gras_os_sleep(0.05);
+ }
- INFO2("Connected to %s:%d.",host,port);
+ INFO2("Connected to %s:%d.",host,port);
/* 5. Register the messages.
See, it doesn't have to be done completely at the beginning, only before use */
/* 5. Register the messages.
See, it doesn't have to be done completely at the beginning, only before use */
#! set timeout 20
& $SG_TEST_ENV ./ping_client$EXEEXT 127.0.0.1 4002 --log=root.fmt=%m%n
> Launch client (server on 127.0.0.1:4002)
#! set timeout 20
& $SG_TEST_ENV ./ping_client$EXEEXT 127.0.0.1 4002 --log=root.fmt=%m%n
> Launch client (server on 127.0.0.1:4002)