SergeNova
Member
There is no other way to update my local ip address in "No-Ip.com" (See example) to connect to my httpserver permanently, or another similar site or any other solution ?
Precisely on these lines of code:
Precisely on these lines of code:
B4X:
Sub Timer1_Tick
Dim job As HttpJob
job.Initialize("exip", Me)
job.Download("http://api.exip.org/?call=ip")
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
Log("Error: (" & Job.JobName & ") " & Job.ErrorMessage)
Else
Select Job.JobName
Case "exip"
Dim ip As String = job.GetString
If ip <> myPublicIp Then
myPublicIp = ip
File.WriteString(File.DirInternal, settingsFile, myPublicIp)
SendNoIpUpdateRequest
End If
Case "no-ip"
If Job.GetString.StartsWith("good") = False Then
Log("Error updating No-IP: " & Job.GetString)
Else
Log("Ip updated correctly: " & Job.GetString)
End If
End Select
End If
Job.Release
End Sub
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", "Basic4android client/1.0 " & ni.Username)
End Sub
Last edited: