SAPGetNearestServer(3sapd)


SAPGetNearestServer -- get information for nearest server of specific type

Synopsis

#include <sap_app.h> 

int SAPGetNearestServer(uint16 ServerType, SAPI *ServerBuf);

Description

SAPGetNearestServer returns the nearest server of the type specified. Server types are defined in the include file.

If your host configuration is set so that the SAP daemon is running, the netInfo_t structure will be filled.

If SAPD is not active, SAPGetAllServers retrieves its information from the network and the netInfo_t structure is then set to NULL.

If successful, the function returns 1 (the number of server entries placed in ServerBuf). If no servers of the specified type exist, the function returns 0.

Parameters

(IN) ServerType
Specifies the type of server requested.

(OUT) ServerBuf
Pointer to the address of a SAPI structure to receive the server entry information.

Usage

The ServerType argument specifies the type of server requested. The ALL_SERVER_TYPE constant is not a legal value for ServerType on this call. The ServerBuf argument specifies the address of a SAPI structure to receive the server entry information.

Return values

If the function fails, it returns a negative number which is the negative of the error code.

1
successful

0
no servers of the specified type exist

<0
unsuccessful

Examples

   ServerType = PRINT_SERVER_TYPE; 
   ret = SAPGetNearestServer (ServerType, &ServerBuf); 

30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.