A new virtual server can be created within the current server process by calling:
unsigned int ts3server_createVirtualServer( | serverPort, | |
serverIp, | ||
serverName, | ||
serverKeyPair, | ||
serverMaxClients, | ||
result) ; |
unsigned int serverPort
;const char* serverIp
;const char* serverName
;const char* serverKeyPair
;unsigned int serverMaxClients
;uint64* result
;
Parameters
serverPort
UDP port to be used for the new virtual server. The default TeamSpeak 3 port is UDP 9987.
serverIp
IP to bind the virtual server to. Pass “0.0.0.0” to bind the virtual server to all IP addresses.
serverName
Name of the new virtual server. This can be later accessed through the virtual server property VIRTUALSERVER_NAME
.
serverKeyPair
Unique keypair of this server. The first time you start this virtual server, pass an empty string, query the keypair with ts3server_getVirtualServerKeyPair
, then save the keypair locally and pass it the next time as parameter to this function.
serverMaxClients
Maximum number of clients (“slots”) which can simultaneously be connected to this virtual server.
result
Address of a variable which receives the ID of the created virtual server.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
. On success, the created virtual server will be automatically started.
![]() | Caution |
---|---|
You should not create a virtual server with an empty keypair except than the first time. If the server should crash, license problems might result when using “throw-away” keypairs, as the license systems might consider you are running more virtual servers than you actually do. Instead query the keypair the first time the virtual server was started, save it to a file and reuse it when creating a new virtual server. This way licensing issues will not occur. See the server sample which is included in the TeamSpeak 3 SDK for an example on how to save and restore keypairs. |
![]() | Note |
---|---|
The TeamSpeak 3 server uses UDP. Support for TCP might be added in the future. |
To query the keypair of a virtual server, use:
unsigned int ts3server_getVirtualServerKeyPair( | serverID, | |
result) ; |
uint64 serverID
;char** result
;
Parameters
serverID
ID of the virtual server for which the keypair is queried.
result
Address of a variable that receives a string with the keypair of this virtual server. Save the keypair and pass it the next time this virtual server is created as parameter to ts3server_createVirtualServer
.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
. If an error has occured, the result string is uninitialized and must not be released.
A virtual server can be stopped with:
unsigned int ts3server_stopVirtualServer( | serverID) ; |
uint64 serverID
;
Parameters
serverID
ID of the virtual server that should be stopped.
Returns ERROR_ok
on success, otherwise an error code as defined in public_errors.h
.