Sub dot2longip(ipaddr As String) As String
Dim iptowork As String
Dim iparray() As String
Dim ip1 As Int
Dim ip2 As Int
Dim ip3 As Int
Dim ip4 As Int
Dim iplongword As Long
Dim dotstoip As String
Dim iplength As Int
iptowork = ipaddr
iparray = Regex.Split("\.", iptowork)
iplength = iparray.Length
Log(iplength)
If iplength = 4 Then
ip1 = iparray(3)
ip2 = iparray(2)
ip3 = iparray(1)
ip4 = iparray(0)
iplongword = ip1 + ip2 * 256 + ip3 * 256 * 256 + ip4 * 256 * 256 * 256
dotstoip = iplongword
End If
Return dotstoip
End Sub
but the result in B4A is different from the php code
I have created a function to count my seconds since January 30, 1899. This function returns a result that is over 3,000,000,000. I thought of using a long, but when effect multiplication has a negative result. What kind of data should I use? I also tried with float and double without success...
www.b4x.com
Modified
B4X:
Dim ip0 As Long
Dim ip1 As Long
Dim ip2 As Long
Dim ip3 As Long