Before connecting to a TeamSpeak 3 server, a new server connection handler needs to be spawned. Each handler is identified by a unique ID (usually called
serverConnectionHandlerID). With one server connection handler a connection can be established and dropped multiple times, so for simply reconnecting to the same or another server no new handler needs to be spawned but existing ones can be reused. However, for using multiple connections simultaneously a new handler has to be spawned for each connection.
To create a new server connection handler and receive its ID, call
Port the client should bind on. Specify zero to let the operating system chose any free port. In most cases passing zero is the best choice.
port is specified, the function return value should be checked for
ERROR_unable_to_bind_network_port. Handle this error by switching to an alternative port until a "free" port is hit and the function returns
Do not specify a non-zero value for
Address of a variable that receives the server connection handler ID.
To destroy a server connection handler, call
ID of the server connection handler to destroy.
Both functions return
ERROR_ok on success, otherwise an error code as defined in
Destroying invalidates the handler ID, so it must not be used anymore afterwards. Also do not destroy a server connection handler ID from within a callback.