我已经使用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;
}发布于 2016-09-21 07:40:22
这个异常还没有记录下来。当我试图使用同一个会话文件连接到电报和呼叫请求时,我遇到了这个异常。似乎当会话文件被不同的多个客户端使用时,会话文件就会损坏。您所要做的就是删除会话文件并重新创建它,就像以前创建的那样。
下面是这样做的一个例子:
FileSessionStore store;
TelegramClient client;
store = new FileSessionStore();
client = new TelegramClient(store, numberToAuthenticate, apiId, apiHash);
await client.Connect();https://stackoverflow.com/questions/39610042
复制相似问题