Initializing help system before first use

XPRDfindxsrvs

XPRDfindxsrvs


Purpose
Search xprmsrv servers on the local network.
Synopsis
int XPRDfindxsrvs(XPRDcontext ctx,int grp,int maxip,unsigned int *addrs);
Arguments
ctx 
XPRD context or NULL to use default settings
grp 
Group number of the request
maxip 
Maximum number of addresses to collect ( i.e. size of addrs)
addrs 
Buffer to return the IP addresses
Return value
The number of IPs stored in addrs or -1 in case of error.
Example
The following example uses this function to find a server and displays its IP address if one is found:
 struct in_addr addr;
 if(XPRDfindxsrvs(NULL,1,1,(unsigned int *)&addr)==1)
  printf("Server found at %s\n",inet_ntoa(addr));
Further information
1. This function sends a broadcast message over the local network and waits for replies from running xprmsrv servers. A given server will reply only to selected group numbers: the grp argument specifies this property.
2. The IP addresses of the hosts having replied to the request are returned via the last argument of the procedure in the form of unsigned integers (to be cast as a struct in_addr for socket functions). The maximum number of IPs is fixed by maxip that cannot be larger than the size of the provided buffer.
Related topics