Difficulties programming a Telegram programmer in C #

I am trying to send a code (TLRequestAuthSendCode), but it does not come. What could be the problem?

Code Part:

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

Link: https://github.com/egor-st-dev/Sharpogram/blob/master/Sharpogram/RequestApiId.cs

+5
source share
3 answers

You can start with this , but I wrote it in vb.net and not in C #.

This will help you start creating your own Telegram API from scratch.

Also try and check out the online documentation, but itโ€™s complicated, but the step-by-step explanation that I gave in this link above, when creating AuthKey , you should start.

Luck

0
source

you can debug your code and report

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

Compounds [0] matter?

I would 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 might break, maybe a more detailed description of your problem would be helpful

+2
source

TcpClient tcpClient = new TcpClient();

As I tried the code, it seemed to me that the port was blocked or already in use. You may have a resolution problem. At least I was not able to get Socket to work with such code. Also, I did not dive into the deep code, but you are using port 443. This is a reserved port with limited access.

+1
source

Source: https://habr.com/ru/post/1207281/


All Articles