buffer_offset+=num_byte;
}
- if (num_byte == 0 || (num_byte <0 && errno != EAGAIN))
+ if (num_byte < 1)
return;
char linebreak_found=0;
int main(int argc, char* argv[])
{
- int ret = 0;
int socket_fd = 0;
char *socket_file;
if (argc > 1)
else
socket_file = default_socket_file_;
- socket_fd = establish_socket_connection(socket_file);
- if(socket_fd)
+ while (1)
{
- sample_sensors(socket_fd);
- }
- else
- {
- fprintf(stderr, "%s error, aborting..\n", socket_file);
- ret=2;
- }
+ socket_fd = establish_socket_connection(socket_file);
+ if(socket_fd)
+ {
+ sample_sensors(socket_fd);
+ }
+ else
+ {
+ fprintf(stderr, "%s error, retrying..\n", socket_file);
+ }
- if(socket_fd > 0)
- shutdown(socket_fd,SHUT_RDWR);
- return(ret);
+ if(socket_fd > 0)
+ shutdown(socket_fd,SHUT_RDWR);
+
+ sleep(2);
+ }
+ return 0;
}
//~ printf("%d:%s\n",num_byte,buffer);
write(STDOUT_FILENO,buffer,num_byte);
}
- if (num_byte == 0 || (num_byte <0 && errno != EAGAIN))
+ if (num_byte < 1)
return;
}
if (stdin_valid_fd && FD_ISSET(STDIN_FILENO,&fds_r))