如何修复电报API中的“ System.Net.Sockets.SocketException”错误?

时间:2019-06-17 10:45:54

标签: c# api sockets telegram

该错误不会关闭程序,它仅在调试时出现。 这是认证代码的一部分。

channelWritter = Worker.GetChannelWriter(phoneTextBox.Text, apiIDTextBox.Text, apiHashTextBox.Text);
Task = new Task(() = >{
    try {
        Application.Current.Dispatcher.Invoke((() = >{
            channelsListView.Visibility = Visibility.Collapsed;
            progress1.IsActive = true;
            progress1.Visibility = Visibility.Visible;
        }));

        var connectTask = Connect();
        connectTask.Wait();

        if (!channelWritter.IsAuthorized) {
            Task.Wait(10000);
            var authTask = AuthorizeRequest();
            authTask.Wait();

            Application.Current.Dispatcher.Invoke((() = >{
                authorizeDialog = new AuthorizeDialog();
                authorizeDialog.ShowDialog();
                if (authorizeDialog.DialogResult == true) {
                    authCode = authorizeDialog.ResponseText;
                }
            }));

            Task.Wait(10000);
            AuthorizeConfirm(authCode).Wait();
        }
    }

0 个答案:

没有答案