GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
lxi_discover(3) FreeBSD Library Functions Manual lxi_discover(3)

lxi_discover - search for LXI devices on network

#include <lxi.h>

int lxi_discover(lxi_info_t *info, int timeout, lxi_discover_t type);

The lxi_discover() function searches for LXI devices or services on the local network using VXI-11 or mDNS/DNS-SD respectively. Which discover type is used is defined as follows:

typedef enum
{
    DISCOVER_VXI11,
    DISCOVER_MDNS
} lxi_discover_t;

During the discover operation events and results are returned by callbacks registered via the info structure, defined as follows:

typedef struct
{
    void (*broadcast)(char *address, char *interface);
    void (*device)(char *address, char *id);
    void (*service)(char *address, char *id, char *service, int port);
} lxi_info_t;

The broadcast callback is called whenever a new network interface is searched (DISCOVER_VXI11 only).

The device callback is called whenever a new LXI device is found (DISCOVER_VXI11 only).

The service callback is called whenever a new LXI service is found (DISCOVER_MDNS only).

The timeout is in milliseconds.

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

The following example searches for LXI devices using VXI-11 and prints the ID and IP addresses of found devices:

#include <stdio.h>
#include <lxi.h>
void broadcast(char *address, char *interface)
{
    printf("Broadcasting on interface %s\n", interface);
}
void device(char *address, char *id)
{
    printf(" Found %s on address %s\n", id, address);
}
int main()
{
    lxi_info_t info;
    // Initialize LXI library
    lxi_init();
    // Set up search information callbacks
    info.broadcast = &broadcast;
    info.device = &device;
    printf("Searching for LXI devices - please wait...\n");
    // Search for LXI devices, 1 second timeout
    lxi_discover(&info, 1000, DISCOVER_VXI11);
    return 0;
}

lxi_init(3) lxi_open(3), lxi_close(3) lxi_receive(3), lxi_disconnect(3),
October 2017

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.