【问题标题】:Difficulties in programming of messenger Telegram on C#C# Messenger Telegram 编程的难点
【发布时间】:2015-01-17 23:22:57
【问题描述】:

我尝试发送代码(TLRequestAuthSendCode),但没有发送。可能有什么问题?

部分代码:

TLContext tlContext = new TLApiContext();
TcpClient tcpClient = new TcpClient();
tcpClient.Connect(connections[0].getAddress(), (int)connections[0].getPort());
TLRequestAuthSendCode tlRequestAuthSendCode = new TLRequestAuthSendCode("PHONE_NUMBER",
0, 19114, "TOKEN", "en");
tlRequestAuthSendCode.serializeBody(new StreamWriter(tcpClient.GetStream()));

【问题讨论】:

  • 向我们展示一些代码,并尝试创建一个SSCCE

标签: c# api rpc messenger telegram


【解决方案1】:

你能调试你的代码并判断是否

tcpClient.Connect(connections[0].getAddress(),

Connections[0] 有值吗?

我建议您将代码更改为以下内容:

        public void run() {
        connections = new ConnectionInfo[]{
            new ConnectionInfo(1, 0, "149.154.167.40", 443)
        };

        apiState = new ApiState(connections);
        doReqCode(connections);

        private void doReqCode(connections){

        var args = new SocketAsyncEventArgs();

我看不出代码可能在哪里中断,也许对您的问题进行更详细的描述会有所帮助

【讨论】:

    【解决方案2】:

    TcpClient tcpClient = new TcpClient();

    当我尝试代码时,在我看来,端口要么被阻塞,要么已经在使用中。也许你在那里有权限问题。至少我没有设法让一个套接字来处理这样的代码。 我也没有深入研究您的代码,但您使用的是端口 443。这是一个访问受限的保留端口。

    【讨论】:

      【解决方案3】:

      您可以从 this 开始,但我是用 vb.net 编写的,而不是 C#。

      它将引导您从头开始构建您自己的 Telegram-API。

      也尝试熟悉在线文档,这很难,但我在上面的link 中给出的关于生成您的AuthKey 的分步解释应该得到你开始了。

      祝你好运

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-03-03
        • 1970-01-01
        • 2013-10-29
        • 2015-12-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多