Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@860 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Oct 14, 2002
1 parent e0f0331 commit 8a72c23
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions mosh/src/mosh.cpp
Expand Up @@ -84,19 +84,28 @@ int main(int argc, char* argv[])
exit (EXIT_FAILURE);
}

sleep(3);

/* Connect to the server. */
struct sockaddr_in servername;
init_sockaddr (&servername, hostname, port);
if (0 > connect (sock,
(struct sockaddr *) &servername,
sizeof (servername)))

int tryconnect = 0;
bool connected=false;
while (!connected && tryconnect < 10 ) {
/* Connect to the server. */
struct sockaddr_in servername;
init_sockaddr (&servername, hostname, port);
if (0 > connect (sock,
(struct sockaddr *) &servername,
sizeof (servername)))
{
perror ("connect (client)");
exit (EXIT_FAILURE);
tryconnect++;
if(connected % 3 == 0) {sleep(1); } // Sleep a second every third try...

} else {
connected=true;
}

}
if (!connected) {
perror("Error connecting to modeq server in interactive mode.\n");
exit(1);
}
bool done=false;
while (!done) {
char* line = readline(">>> ");
Expand Down

0 comments on commit 8a72c23

Please sign in to comment.