Query available servers, channels and clients

## Query available servers, channels and clients

A client can connect to multiple servers. To list all currently existing server connection handlers, call:

`unsigned int ts3client_getServerConnectionHandlerList(` | result`)`; |

`uint64** result`;

Parameters

- `result`

  Address of a variable that receives a NULL-termianted array of all currently existing server connection handler IDs. Unless an error occurs, the array must be released using `ts3client_freeMemory`.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`. If an error has occured, the result array is uninitialized and must not be released.

A list of all channels on the specified virtual server can be queried with:

`unsigned int ts3client_getChannelList(` | serverConnectionHandlerID, |
| result`)`; |

`uint64 serverConnectionHandlerID`;
`uint64** result`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler for which the list of channels is requested.

- `result`

  Address of a variable that receives a NULL-termianted array of channel IDs. Unless an error occurs, the array must be released using `ts3client_freeMemory`.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`. If an error has occured, the result array is uninitialized and must not be released.

To get a list of all currently visible clients on the specified virtual server:

`unsigned intts3client_getClientList(` | serverConnectionHandlerID, |
| result`)`; |

`uint64 serverConnectionHandlerID`;
`anyID** result`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler for which the list of clients is requested.

- `result`

  Address of a variable that receives a NULL-termianted array of client IDs. Unless an error occurs, the array must be released using `ts3client_freeMemory`.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`. If an error has occured, the result array is uninitialized and must not be released.

To get a list of all clients in the specified channel if the channel is currently subscribed:

`unsigned int ts3client_getChannelClientList(` | serverConnectionHandlerID, |
| channelID, |
| result`)`; |

`uint64 serverConnectionHandlerID`;
`uint64 channelID`;
`anyID** result`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler for which the list of clients within the given channel is requested.

- `channelID`

  ID of the channel whose client list is requested.

- `result`

  Address of a variable that receives a NULL-termianted array of client IDs. Unless an error occurs, the array must be released using `ts3client_freeMemory`.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`. If an error has occured, the result array is uninitialized and must not be released.

To query the channel ID the specified client has currently joined:

`unsigned int ts3client_getChannelOfClient(` | serverConnectionHandlerID, |
| clientID, |
| result`)`; |

`uint64 serverConnectionHandlerID`;
`anyID clientID`;
`uint64* result`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler for which the channel ID is requested.

- `clientID`

  ID of the client whose channel ID is requested.

- `result`

  Address of a variable that receives the ID of the channel the specified client has currently joined.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`.

To get the parent channel of a given channel:

`unsigned int ts3client_getParentChannelOfChannel(` | serverConnectionHandlerID, |
| channelID, |
| result`)`; |

`uint64 serverConnectionHandlerID`;
`uint64 channelID`;
`uint64* result`;

Parameters

- `serverConnectionHandlerID`

  ID of the server connection handler for which the parent channel of the specified channel is requested.

- `channelID`

  ID of the channel whose parent channel ID is requested.

- `result`

  Address of a variable that receives the ID of the parent channel of the specified channel.

  If the specified channel has no parent channel, `result` will be set to the reserved channel ID 0.

Returns `ERROR_ok` on success, otherwise an error code as defined in `public_errors.h`.

Example code to print a list of all channels on a virtual server:

    uint64* channels;

    if(ts3client_getChannelList(serverID, &channels) == ERROR_ok) {
        for(int i=0; channels[i] != NULL; i++) {
            printf("Channel ID: %u\n", channels[i]);
        }
        ts3client_freeMemory(channels);
    }

To print all visible clients:

    anyID* clients;

    if(ts3client_getClientList(scHandlerID, &clients) == ERROR_ok) {
        for(int i=0; clients[i] != NULL; i++) {
            printf("Client ID: %u\n", clients[i]);
        }
        ts3client_freeMemory(clients);
    }

Example to print all clients who are member of channel with ID 123:

    uint64 channelID = 123;  /* Channel ID in this example */
    anyID *clients;

    if(ts3client_getChannelClientList(scHandlerID, channelID) == ERROR_ok) {
        for(int i=0; clients[i] != NULL; i++) {
            printf("Client ID: %u\n", clients[i]);
        }
        ts3client_freeMemory(clients);
    }

3D Sound |  | Retrieve and store information