1lxi_discover(3)               C Library Functions              lxi_discover(3)
2
3
4

NAME

6       lxi_discover - search for LXI devices on network
7
8

SYNOPSIS

10       #include <lxi.h>
11
12       int lxi_discover(lxi_info_t *info, int timeout, lxi_discover_t type);
13
14

DESCRIPTION

16       The lxi_discover() function searches for LXI devices or services on the
17       local network using VXI-11 or mDNS/DNS-SD respectively. Which  discover
18       type is used is defined as follows:
19
20
21       typedef enum
22       {
23           DISCOVER_VXI11,
24           DISCOVER_MDNS
25       } lxi_discover_t;
26
27
28       During  the discover operation events and results are returned by call‐
29       backs registered via the info structure, defined as follows:
30
31       typedef struct
32       {
33           void (*broadcast)(char *address, char *interface);
34           void (*device)(char *address, char *id);
35           void (*service)(char *address, char *id, char *service, int port);
36       } lxi_info_t;
37
38
39       The broadcast callback is called whenever a new  network  interface  is
40       searched (DISCOVER_VXI11 only).
41
42       The  device callback is called whenever a new LXI device is found (DIS‐
43       COVER_VXI11 only).
44
45       The service callback is called whenever a  new  LXI  service  is  found
46       (DISCOVER_MDNS only).
47
48
49       The timeout is in milliseconds.
50
51

RETURN VALUE

53       Upon successful completion lxi_discover() returns LXI_OK , or LXI_ERROR
54       if an error occurred.
55
56

EXAMPLE

58       The following example searches for LXI devices using VXI-11 and  prints
59       the ID and IP addresses of found devices:
60
61       #include <stdio.h>
62       #include <lxi.h>
63
64       void broadcast(char *address, char *interface)
65       {
66           printf("Broadcasting on interface %s\n", interface);
67       }
68
69       void device(char *address, char *id)
70       {
71           printf(" Found %s on address %s\n", id, address);
72       }
73
74       int main()
75       {
76           lxi_info_t info;
77
78           // Initialize LXI library
79           lxi_init();
80
81           // Set up search information callbacks
82           info.broadcast = &broadcast;
83           info.device = &device;
84
85           printf("Searching for LXI devices - please wait...\n");
86
87           // Search for LXI devices, 1 second timeout
88           lxi_discover(&info, 1000, DISCOVER_VXI11);
89
90           return 0;
91       }
92
93

SEE ALSO

95       lxi_discover_if(3)   lxi_init(3)   lxi_open(3),   lxi_close(3)  lxi_re‐
96       ceive(3), lxi_disconnect(3),
97
98
99
100liblxi 1.20                       2022-09-28                   lxi_discover(3)
Impressum