Android Question WEB Controller by TCP/IP

laiberica

Member
Licensed User
Hello, im needing to connect to a web controller by TCP-IP which have an dyndns with user and password.
I need to connect to it and send commands to control it.
Can someone help me with it? Thanks
 

laiberica

Member
Licensed User
With httpjob i can connect, but i dont know how i can execute commands on it

example:

Dim jobb As HttpJob

jobb.Initialize("Jobb", Me)
jobb.Username="DT"
jobb.Password="XXXXXX"
jobb.download("http://controlhXXX.dyndns.org")

This works and connect good.

With command "?Ox" (x=number) i can get output value for example, but i dont understand how use it...
 

laiberica

Member
Licensed User
Seller tell me that controller dont have authentication, i must connect by tcp/ip and send commands directly, i can use putty app and works fine localy.

In this app that im developing i must connect with authentication because i use dyndns to connect of another place. Router connect directly to the controller.

Any idea to send commands with httpjob or similar? Thanks!
 

DanteS

Member
Licensed User
When you connect to the server using Putty, do you receive some kind of cursor to know when the server is ready to begin talking?
If so, check if you receive this character when you connect.
 

DanteS

Member
Licensed User
I asked first if you receive a cursor (sometimes a ">", or "-" or "$") once you connect locally to the device. If so, when you try to connect remotely, using an android device, you have to check if you receive the same character.
 

laiberica

Member
Licensed User
SSH looks god, im trying to use, i have an error:

SSH2.initialize("SSH", "xxxxxxx.dyndns.org", 80)
SSH2.authenticateWithPassword("DT", "XXXXX")
Log(SSH2.IsConnected) 'Log show false here

SSH2.execCommand("?O1", 10)

execCommand shows this error:
android.os.NetworkOnMainThreadException
 

laiberica

Member
Licensed User
Thanks, the error dont appear more, but now it shows "SSH2.executingCommand" in loop, waiting but nothing..
 

lemonisdead

Well-Known Member
Licensed User
Please are you using jkSSH2 ? I ask you this because I took the time to test the library to check if it worked and I didn't got any "SSH2.executingCommand" in my logs.
Tests done connecting to a remote server.

The result I get is inside the sub
B4X:
Sub SSH2_CmdExecuted (Success As Boolean, Result As List, TaskId As Int)
End Sub
** Activity (main) Create, isFirst = true **
>>> [SSH]: Connection was successfully established.
>>> [SSH]: Command was successfully executed.
>>> [SSH]: Connection was closed. Reason: Closed due to user request.
While
B4X:
SSH2.DebugOutput=True
 

laiberica

Member
Licensed User
I was talking with controller manufacturer and tell me that i must connect by telnet.
I Used puTTY and it works fine...
 
Top