[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting timeout error while reading data.

From: Bhavna Harani
Subject: Getting timeout error while reading data.
Date: Fri, 15 Jul 2022 11:50:31 +0530

Hello All,

I am giving data dynamically to gpsd over udp by the below command.
gpsd -D 1 -n udp://

every 1 second I am feeding data to udp socket. When I tried to read the data
using gpslib I got a timeout error. 
Below is a snippet to feed data at 1 second frequency.
while(fgets(buffer, bufferLength, filePointer))
    printf("%s\n", buffer);
sendto(sockfd, buffer, strlen(buffer),MSG_CONFIRM, (const struct sockaddr *) &servaddr,sizeof(servaddr));

Below is a snippet for reading the data.
if (0 != gps_open("localhost", "2947", &gpsd_gps_data))
printf( "LC79D_GNSS open error");
/*enable watch enable from gpsd demon*/
(void)gps_stream(&gpsd_gps_data, WATCH_ENABLE | WATCH_JSON, NULL);
// Wait for data available.
#define GNSS_DATA_TIME_OUT  5000000
while (gps_waiting(&gpsd_gps_data, GNSS_DATA_TIME_OUT))
if (-1 == gps_read(&gpsd_gps_data, NULL, 0))
{printf ( "GNSS Read ERROR");
printf ( "timeout");
 I have tried with "gpspipe -r" ,I was able to get a raw string which I parsed dynamically.

Thanks & Regards,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]