I am trying to add and import a contact for sending message but i am getting time out exception every time.
Correct me if something is wrong.
Code:
TLInputContact tlic=new TLInputContact(1, PhNo, Fname, Lname);
TLVector contacts = new TLVector<>();
contacts.add(tlic);
TLRequestContactsImportContacts importContacts = new TLRequestContactsImportContacts(contacts, true);
TLImportedContacts importedContacts = api.doRpcCall(importContacts);
TLAbsUser recipient=importedContacts.getUsers().get(0);
TLInputPeerContact peer = new TLInputPeerContact(recipient.getId());
TLRequestMessagesSendMessage sendMessageRequest = new TLRequestMessagesSendMessage(peer, "Test", rnd.nextInt());
TLAbsSentMessage sentMessage = api.doRpcCall(sendMessageRequest);
Log::
TelegramApi#1001:Timeout Iteration
ActorDispatcher:Dispatching action: schedule for scheduller
ActorDispatcher:Dispatching action: schedule for scheduller
TelegramApi#1001:Timeout Iteration
TelegramApi#1001:RPC #3: Timeout (15001 ms)
Exception in thread "main" org.telegram.api.engine.TimeoutException
at org.telegram.api.engine.TelegramApi.doRpcCall(TelegramApi.java:364)
at org.telegram.api.engine.TelegramApi.doRpcCall(TelegramApi.java:309)
at org.telegram.api.engine.TelegramApi.doRpcCall(TelegramApi.java:400)
at org.telegram.api.engine.TelegramApi.doRpcCall(TelegramApi.java:396)
at testmsg.Testmsg.main(Testmsg.java:151)
TelegramApi#1001:Timeout Iteration
2
Answers
Try
doRpcCallSide
instead ofdoRpcCall
in TelegramApi object.It helped me.
It started working for me after I updated Server IP Address in the MemoryStateAPI class, as shown below –