连接到Teamspeak 3

时间:2018-11-24 19:02:29

标签: c# .net teamspeak

我尝试使用TS3QueryLib连接到Teamspeak3。但是我得到了错误信息:套接字错误!错误代码:超时。此外,不可能在服务器的连接字符串中添加密码。

using TS3QueryLib.Core;
using TS3QueryLib.Core.Common;
using TS3QueryLib.Core.Common.Responses;
using TS3QueryLib.Core.Communication;
using TS3QueryLib.Core.Server;
using TS3QueryLib.Core.Server.Responses;

那是连接功能:

        public void Connect()
    {
        // do not connect when already connected or during connection establishing
        if (QueryDispatcher != null)
            return;

        if (string.IsNullOrWhiteSpace(ServerAddressTextBox.Text))
        {
            MessageBox.Show("Please provide a server address!");
            return;
        }

        ushort port;


        if (!ushort.TryParse(ServerPort.Text, out port))
        {
            MessageBox.Show("Please provide a valid query port!");
            return;
        }

        UpdateUI(ConnectionState.Connecting);
        QueryDispatcher = new AsyncTcpDispatcher(ServerAddressTextBox.Text.Trim(), port);
        QueryDispatcher.BanDetected += QueryDispatcher_BanDetected;
        QueryDispatcher.ReadyForSendingCommands += QueryDispatcher_ReadyForSendingCommands;
        QueryDispatcher.ServerClosedConnection += QueryDispatcher_ServerClosedConnection;
        QueryDispatcher.SocketError += QueryDispatcher_SocketError;
        QueryDispatcher.Connect();
    }

0 个答案:

没有答案