Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 2 of 2
  1. #1
    Join Date
    August 2016
    Posts
    2

    C# - ts3client_startConnection - How to pass in defaultChannelArray

    I have this question posted on StackOverflow as well if you need a little more context: http://stackoverflow.com/questions/3...t-startconnect

    Anyway, I am using the ts3client SDK and I am trying to pass the defaultChannelArray parameter to ts3client_startConnection().

    Here is the code straight from the example:

    Code:
    string defaultarray = "";
    /* Connect to server on localhost:9987 with nickname "client", no default channel, no default channel password and server password "secret" */
    error = ts3client.ts3client_startConnection(scHandlerID, identity, "localhost", 9987, "client", ref defaultarray, "", "secret");
    if (error != public_errors.ERROR_ok) {
    	Console.WriteLine("Error connecting to server: 0x{0:X4}", error);
    	Console.ReadLine();
    	return;
    }
    Anytime I try to change defaultarray to anything other than "", I get an AccessViolationException (Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.)

    What is the correct way to pass a C# string to startConnection()'s defaultChannelArray parameter?

    Thanks!

  2. #2
    Join Date
    August 2016
    Posts
    2
    It has been solved! You can view my supplied answer on StackOverflow here: http://stackoverflow.com/a/39169135/3924174

    Basically I changed the DllImport to
    Code:
    string[] defaultChannelArray
    from
    Code:
    ref string defaultChannelArray
    and passed in a simple string array.

    My client was then able to join a different channel!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: April 17th, 2018, 11:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •