CmGetServers
Description
CmGetServers searches the local network for running CodeMeter processes.
|
Triple Mode Redundancy-related information (TMR)
|
Syntax
int CMAPIENTRY CmGetServers(CMULONG flCtrl, char *pszServer, CMUINT cbServer, CMUINT *pnNumberOfServers)
Parameter
flCtrl contains one of three possible flags to return the server identity:
CM_GS_IPADDR returns the computers using their IP address(es).
CM_GS_NAME returns the computers using their names, if resolving the name is possible.
|
Since CodeMeter Version 6.60 it is possible to combine CM_GS_IPADDR and CM_GS_NAME to get both server identities using one call. Name and IP specifications are separated by "|". |
CM_GS_IPADDR_IPv6MAPPED: returns each IPv4 address as IPv4-mapped IPv6 address, e.g. "192.0.2.128" as "::ffff:192.0.2.128".
The found server list can be returned by two kinds of calling mechanisms:
CM_GS_LIST returns all found servers per one function call. The computer names / IP addresses are separated by a "|".
NameServer1|NameServer2|NameServer3 for flCtrl = CM_GS_NAME|CM_GS_LIST
IpServer1|IpServer2|IpServer3 for flCtrl = CM_GS_IPADDR|CM_GS_LIST
NameServer1|IpServer1|NameServer2|IpServer2|NameServer3|IpServer3 for flCtrl = CM_GS_IPADDR|CM_GS_NAME|CM_GS_LIST
CM_GS_SINGLE returns only one computer per function call. The next call will return the next computer stored internally. If no server is left in the list, FALSE is returned and error code CM_ERROR_SERVER_NOT_FOUND is set. To restart the output at the first internally stored server the flag CM_GS_SINGLE_FIRST must be used.
CM_GS_SINGLE_FIRST must be set at the first call to get a single computer (NameServer1|IpServer1). This flag sets the internal pointer to the beginning of the list. This flag must always be set before a call using CM_GS_SINGLE.
The following flags can be or'ed to specify which servers should be included in the results:
CM_GS_ALL_SERVERS returns all found servers and even those servers where no CmContainer is connected to.
CM_GS_REMOTE_SERVERS_ONLY returns only remote CodeMeter servers machines.
CM_GS_INCLUDE_CMWAN_SERVERS returns also CmWAN servers that are found in the server search list. For such CmWAN servers always the name is returned ignoring the flags CM_GS_IPADDR and CM_GS_IPADDR_IPv6MAPPED.
pszServer contains a pointer to an output buffer.
cbServer contains the length of the output buffer pszServer in number of bytes.
nNumberOfServers returns the number of found servers when used with CM_GS_LIST or CM_GS_ALL_SERVERS and CM_GS_SINGLE_FIRST flags. Used with CM_GS_SINGLE it returns 0 or 1.
Return
Returns the number of stored bytes in the output buffer. The IP address list returned in pszServer is sorted on the IP addresses.
Exception:
If pvDest does not contain enough memory, the number of required bytes will be returned. In this case, the return value is larger than the cbDest parameter and error code CMERROR_BUFFER_OVERFLOW is set.
Syntax
This method is overloaded, i.e. the same method name is used with different type of parameters or different set of parameters.
Method 1:
public string[] CmGetServers(CmGetServersOption Ctrl, out int NumberOfServers)
|
The return covers the number of found servers.
Method 2:
public string[] CmGetServers(CmGetServersOption Ctrl)
|
The return is a string covering an array of found servers.
Parameter
CmGetServersOption contains possible flags to return the server identity
IpAdress returns the computers using their IP address in the lookup process.
List returns all found servers per one function call. The computer names / IP addresses are separated by a "|".
SingleFirst must be set at the first call to get a single computer. This flag sets the internal pointer to the beginning of the list. This flag must always be set before a call using Single.
Single returns only one computer per function call. The next call will return the next computer stored internally. If no server is left in the list, false is returned and error code CM_ERROR_SERVER_NOT_FOUND is set. To restart the output at the first internally stored server the flag SingleFirst must be used.
CmdMask specifies mask bit values excluding found servers.
Name returns the computers using their names in the lookup process.
AllServers returns all found servers and even those servers where no CmContainer is connected to.
RemoteServersOnly returns only remote CodeMeter servers machines.
IpAddressIPv6Mapped returns each IPv4 address as IPv4-mapped IPv6 address, e.g. "192.0.2.128" as "::ffff:192.0.2.128".
IncludeCmWanServers returns also CmWAN servers that are found in the server search list. For such CmWAN servers always the name is returned ignoring the flags IpAdress and IpAddressIPv6Mapped.
NumberOfServers returns the number of found servers when used with List or AllServers and SingleFirst flags. Used with Single it returns 0 or 1.
Return
Returns a string array with the found servers. The IP address list returned is sorted on the IP addresses.
Syntax
import cmapi
cmapi.CodeMeter().CmGetServers(flCtrl: int) -> GetServerResult
throws CodeMeterApiFailedExcetion()
Parameter
flCtrl contains one of three possible flags to return the server identity:
cmapi.CM_GS_IPADDR returns the computers using their IP address(es).
cmapi.CM_GS_NAME returns the computers using their names, if resolving the name is possible.
|
Since CodeMeter Version 6.60 it is possible to combine cmapi.CM_GS_IPADDR and cmapi.CM_GS_NAME to get both server identities using one call. Name and IP specifications are separated by "|". |
cmapi.CM_GS_IPADDR_IPv6MAPPED: returns each IPv4 address as IPv4-mapped IPv6 address, e.g. "192.0.2.128" as "::ffff:192.0.2.128".
The found server list can be returned by two kinds of calling mechanisms:
cmapi.CM_GS_LIST returns all found servers per one function call. The computer names / IP addresses are separated by a "|".
NameServer1|NameServer2|NameServer3 for flCtrl = cmapi.CM_GS_NAME|CM_GS_LIST
IpServer1|IpServer2|IpServer3 for flCtrl = cmapi.CM_GS_IPADDR|CM_GS_LIST
NameServer1|IpServer1|NameServer2|IpServer2|NameServer3|IpServer3 for flCtrl = cmapi.CM_GS_IPADDR|cmapi.CM_GS_NAME|cmapi.CM_GS_LIST
cmapi.CM_GS_SINGLE returns only one computer per function call. The next call will return the next computer stored internally. If no server is left in the list, FALSE is returned and error code cmapi.CM_ERROR_SERVER_NOT_FOUND is set. To restart the output at the first internally stored server the flag cmapi.CM_GS_SINGLE_FIRST must be used.
cmapi.CM_GS_SINGLE_FIRST must be set at the first call to get a single computer (NameServer1|IpServer1). This flag sets the internal pointer to the beginning of the list. This flag must always be set before a call using cmapi.CM_GS_SINGLE.
The following flags can be or'ed to specify which servers should be included in the results:
cmapi.CM_GS_ALL_SERVERS returns all found servers and even those servers where no CmContainer is connected to.
cmapi.CM_GS_REMOTE_SERVERS_ONLY returns only remote CodeMeter servers machines.
cmapi.CM_GS_INCLUDE_CMWAN_SERVERS returns also CmWAN servers that are found in the server search list. For such CmWAN servers always the name is returned ignoring the flags cmapi.CM_GS_IPADDR and cmapi.CM_GS_IPADDR_IPv6MAPPED.
Return
Returns a GetServerResult object. This object offers two methods: count() giving the number of found elements and servers() that returns a list of "str" objects. In the case of failure, an exception is thrown.