owlps/libowlps-resultreader-udp/owlps-resultreader-udp.c

35 lines
638 B
C
Raw Normal View History

/*
* This is a simple program to demonstrate the use of
* libowlps-resultreader-udp.
* It must be linked against libowlps and its dependencies
* (see the Makefile).
*/
#include "owlps-resultreader-udp.h"
#include <unistd.h>
int main(void)
{
owl_result *result ;
int sockfd ;
sockfd = owl_create_udp_listening_socket(MOBILE_DEFAULT_PORT) ;
if (sockfd < 0)
return 1 ;
while (1)
{
owl_receive_position(sockfd, &result) ;
if (result == NULL)
return 1 ;
owl_print_result(result) ;
owl_free_result(result) ;
printf("--------------\n") ;
}
close(sockfd) ;
return 0 ;
}