【问题标题】:Connection to dc in telegram api java在电报api java中连接到dc
【发布时间】:2017-02-12 08:00:27
【问题描述】:

我尝试使用java telegram api 连接到电报。在这段代码上它会抛出异常

    private static void createApi() throws IOException {
    apiState = new ApiStorage(true);
    api = new TelegramApi(apiState, new AppInfo(API_ID, "console", "2", "1", "en"), new ApiCallback() {

        @Override
        public void onAuthCancelled(TelegramApi api) {

        }

        @Override
        public void onUpdatesInvalidated(TelegramApi api) {

        }

        @Override
        public void onUpdate(TLAbsUpdates updates) {
        }
    });
}

这是我在控制台中看到的:

TelegramApi#1001:Phase 0 in 1 ms
TelegramApi#1001:Phase 1 in 119 ms
TelegramApi#1001:Timeout Iteration
TelegramApi#1001:Connection iteration
TelegramApi#1001:#1: waitForDc
TelegramApi#1001:#1: Creating proto for dc
TelegramApi#1001:#1: Creating key
TelegramApi#1001:Phase 2 in 7 ms
TelegramApi#1001:Sender iteration
TelegramApi#1001:Phase 3 in 7 ms
api#1001#Uploader:UploadFileThread iteration
api#1001#Uploader:UploadFileThread iteration
api#1001#Uploader:UploadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
api#1001#Uploader:UploadFileThread iteration
api#1001#Downloader:DownloadFileThread iteration
TransportRate:Transport: #1 149.154.167.40:443 #1.0
TransportRate:tryConnection #1
java.net.BindException: Cannot assign requested address: connect

我不知道我做错了什么。

【问题讨论】:

    标签: java websocket telegram mtproto


    【解决方案1】:

    该错误意味着您无法连接到提供的地址 (149.154.167.40:443)。从您当前的位置来看,可能是错误的、过时的或无法访问的。

    一些数据中心 (DC) 地址: https://github.com/telegramdesktop/tdesktop/blob/master/Telegram/SourceFiles/config.h#L212

    也看看这些方法:help.getConfighelp.getNearestDc.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-27
      • 1970-01-01
      相关资源
      最近更新 更多