B4J Question No-ip and B4j

micro

Well-Known Member
Licensed User
Longtime User
Hi to all,
I used dynamicip.bas for android with same modify for B4j.
I set up a free account on noip.com and my host is xxxxxx.ddns.net.
Now when i launch program, the ceck currently ip is correct but when run Sub "SendNoIpUpdateRequest" Job.Success return false.
This is code in Main:
B4X:
Private dinip As Dynamicip
...................
Sub Inizializza
    Dim ni As NoIpValues
    ni.Initialize
    ni.Host = "http://xxxxxx.ddns.net"
    ni.Username = "yyyyyyyyyy"
    ni.Password = "zzzzzzzzzzzz"
    dinip.Initialize(ni)
End Sub
and attached bas module.
 

Attachments

  • Dynamicip.bas
    2.1 KB · Views: 215

micro

Well-Known Member
Licensed User
Longtime User
Check the logs. There should be more information.
Log:
Program started.
badauth
Error: (no-ip) Unauthorized

The Host is active on no-ip site.
Is correct the request in Sub "SendNoIpUpdateRequest"?
(Why current ip is not sent to no-ip site?)

B4X:
Sub SendNoIpUpdateRequest
    Dim j As HttpJob
    j.Initialize("no-ip", Me)
    j.Download2("http://dynupdate.no-ip.com/nic/update", Array As String("hostname", ni.Host))
    Dim su As StringUtils
    Dim usernameAndPassword As String = ni.Username & ":" & ni.Password
    j.GetRequest.SetHeader("Authorization", "Basic " & su.EncodeBase64(usernameAndPassword.GetBytes("UTF8")))
    j.GetRequest.SetHeader("User-Agent", "Test B4j " & ni.Username)
End Sub
 
Last edited:
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
strangely password is wrong, now reset and correct.
Now Job.Success return true but Job.GetString is always empty.
I added myipbublic in J.Dounload2 but it is always the same result.
B4X:
Dim j As HttpJob
    j.Initialize("no-ip", Me)
    j.Download2("https://dynupdate.no-ip.com/nic/update", Array As String("hostname", ni.Host, "myip", myPublicIp))

Thanks for your help.
 
Upvote 0
Top