【发布时间】:2016-09-21 15:40:22
【问题描述】:
我已经使用TLSharp 库一周了,但最近我遇到了异常:
CHANNELS_TOO_MUCH
我的代码甚至无法通过await client.connect() 函数。我没有在库的 GitHub 存储库上找到任何描述此异常发生原因的文档。我似乎不是因为电报限制而发生的异常,因为它在connect 函数处给了我这个异常。
这是我的代码:
public static async Task<TelegramClient> connectTelegram()
{
store = new FileSessionStore();
client = new TelegramClient(store, numberToAuthenticate, apiId, apiHash);
try
{
await client.Connect();
}
catch (InvalidOperationException e)
{
Debug.WriteLine("Invalid Operation Exception");
if (e.Message.Contains("Couldn't read the packet length"))
{
Debug.WriteLine("Couldn't read the packet length");
Debug.WriteLine("Retying to Connect ...");
}
await connectTelegram();
}
catch (System.IO.IOException)
{
Debug.WriteLine("IO Exception while Connecting");
Debug.WriteLine("Retrying to Connect ...");
await connectTelegram();
}
catch(Exception e)
{
Debug.WriteLine(e.Message):
}
return client;
}
【问题讨论】: