1
我一直在使用TLSharp库了一个星期,但最近我遇到了异常:TLsharp CHANNELS_TOO_MUCH异常
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;
}