C# How to host TeamSpeak3 SDK Server for TeamSpeak3 SDK to be able to connect

Viewed 17

Right now i created simple code based on TeamSpeak3 SDK examples for connection to server and listing on one of the events.

Code:

Connection connection;
var path = Path.GetFullPath("../../../../../sources/bin");
LibraryParameters parameters = new LibraryParameters(path);
parameters.UsedLogTypes = LogTypes.File | LogTypes.Console | LogTypes.Userlogging;
Library.Initialize(parameters);

connection = Library.SpawnNewConnection();

connection.OpenPlayback();
Console.WriteLine($"Playback: {connection.PlaybackDevice}");
connection.OpenCapture();
Console.WriteLine($"Capture: {connection.CaptureDevice}");

connection.TalkStatusChanged += Connection_TalkStatusChanged;

Task starting = connection.Start(Library.CreateIdentity(), "ip_here", 9987, "game_sense");
void Connection_TalkStatusChanged(Client client, TalkStatus status, bool isReceivedWhisper)
{
    string verb = status != TalkStatus.NotTalking ? "starts" : "stops";
    Console.WriteLine($"Client {client.Nickname} {verb} talking.");
}
try
{
    starting.Wait();
}
catch (AggregateException e)
{
    if (e.InnerException is TeamSpeakException)
    {
        Error errorCode = ((TeamSpeakException)e.InnerException).ErrorCode;
        Console.WriteLine("Failed to connect to server: {0}", errorCode);
        return;
    }
    else
    {
        throw;
    }
}

Everything works fine until starting.Wait() gets called. It returns exception: failed connection initialization

I search most popular post's about this error and i found out that TeamSpeak SDK Clinet(i think im using it here, maybe its something else and i don't know, then help ;-;) can only connect to TeamSpeak SDK Server.

Question is what is TeamSpeak SDK Server? Is it something else then what i download on: https://www.teamspeak.com/en/downloads/#server ?

My server right now is setUp on VPS machine at one of the hostings. I enabled UDP 9987 port in there: enter image description here

Also i see that server is running fine, cuz i can connect to it. If someone know how to help with this problem, or maybe can see my mistakes please help.

0 Answers
Related