skip to Main Content

I try to send a code(TLRequestAuthSendCode) but it doesn’t come. In what there can be a problem?

Part of code:

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()));

3

Answers


  1. TcpClient tcpClient = new TcpClient();

    As i tried the code, it mostly seemd to me as if the port was either blocked or already in use. Maybe u have a permission problem there. At least i didnt manage to get a Socket to work with the code like that.
    Also i didnt dive to deep in your code, but you are using port 443. This is a reserved port with limited access.

    Login or Signup to reply.
  2. can you debug your code and tell if

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

    Connections[0] has a value?

    I’d suggest you change your code to the following:

            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();
    

    I don’t see where the code could break, maybe a more detailed description of your problem would be helpful

    Login or Signup to reply.
  3. You can get started with this, but I have written it in vb.net, not C#.

    It will walk you through getting started building your own Telegram-API from scratch.

    Also try and get familiar with the online documentation, it’s hard but the step by step explanation I gave in that link above on generating your AuthKey, should get you started.

    Good Luck

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search