B4J Question Telnet to Miktorik router

wl

Well-Known Member
Licensed User
Longtime User
Hi,

I'm trying to control my Microtik router through a telnet session (locally, so no need for SSH).

When I do a telnet session I get something like:

B4X:
MikroTik v6.39.2 (stable)
Login:

I tried to implement this with an AsyncstreamText, but it seems the NewText as never called, so I tried Asyncstreams:

B4X:
Public Sub Connect (server As String, password As String)
    sck.Initialize("sck")
    sck.Connect(server, 23, 30000)
End Sub
Private Sub sck_Connected (Successful As Boolean)
    If Successful Then
        ast.Initialize(sck.InputStream, sck.OutputStream, "ast")
    End If
End Sub
Private Sub ast_NewData (Buffer() As Byte)
    Log (BytesToString(Buffer, 0, Buffer.Length, "ASCII"))
End Sub


I then only receive 6 "funny' characters ...

What am I missing ?

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Try to change the Encoding
 
Upvote 0

wl

Well-Known Member
Licensed User
Longtime User
Thanks but I tried all kinds of encoding: to no avail.

I also receive an insufficient amount of bytes. It seems there is some kind of handshake. Note that when I open a telnet session in command windows, the session is multi color.

Thanks
 
Upvote 0
Top