#include <sap_app.h>int SAPGetServerByName(char ServerName, uint16 ServerType, int ServerEntry, SAPI ServerBuf, int MaxEntries);
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.
Some limited wildcard capabilities are allowed in this function. If the final character of ServerName is an asterisk (), the string is matched up only to the asterisk.
sizeof(SAPI MaxEntries)which will be filled with SAPI entries.
The ServerType argument specifies either the type of server desired or ALL_SERVER_TYPE to obtain information on all servers with that name.
The ServerEntry argument must be set to zero (0) on the first call and is updated by SAPGetServerByName. The updated value should be returned on subsequent calls. You should not modify the contents of ServerEntry except to set the initial value to zero.
The ServerBuf argument specifies the address of a buffer whose size is calculated as follows:
sizeof(SAPI MaxEntries)which will be filled with SAPI entries.
The MaxEntries argument specifies the maximum number of SAPI entries which can be put in ServerBuf.
If successful, the function returns the number of SAPI entries placed in ServerBuf. The ServerEntry argument is set to index of the next server entry to be read when the next call is made. All server entries have been returned when the function return value is zero or less than the MaxEntries.
strcpy (ServerName, "TEST_SERVER"); ServerType = FILE_SERVER_TYPE; ServerEntry = 0; MaxEntries = 1; ret=SAPGetServerByName(ServerName,ServerType,&ServerEntry,&ServerBuf, MaxEntries);