{
close(sock);
perror("Cannot connect to stream socket");
- exit(-1);
+ return -1;
}
return sock;
fd_set ready;
char message[256];
- sock = make_socket( host.c_str(), port );
+ while ( (sock = make_socket( host.c_str(), port )) < 0 ) {
+ // loop till we get a socket connection
+ sleep(1);
+ }
// build a command string from the argv[]'s
strcpy(message, "hello world!\n");
string host = argv[1];
int port = atoi( argv[2] );
- while ( true ) {
- tile = get_next_task( host, port );
+ while (
+ (tile = get_next_task( host, port )) >= 0
+ )
+ {
run_task( tile );
}
}
}
b = FGBucket( lon, lat );
- cout << "Bucket = " << b << endl;
+ cout << "Bucket = " << b << " (" << pass << ")" << endl;
// increment to next tile
FGBucket tmp( 0.0, lat );
cout << "socket is connected to port = " << port << endl;
// Specify the maximum length of the connection queue
- listen(sock, 3);
+ listen(sock, 10);
for ( ;; ) {
FD_ZERO(&ready);
// get the next tile to work on
next_tile = get_next_tile(work_base, output_base);
- cout << "next tile = " << next_tile << endl;;
+ // cout << "next tile = " << next_tile << endl;;
msgsock = accept(sock, 0, 0);
// cout << "msgsock = " << msgsock << endl;