tufanv Expert Licensed User Longtime User May 7, 2018 #1 Hello I am trying to use Code: Copy Dim server As ServerSocket 'ignore Log(server.GetMyIP) to get the ip of the user but it returns the network local ip like 192.168.x.x , how can i get the real ip of the user ? Ty
Hello I am trying to use Code: Copy Dim server As ServerSocket 'ignore Log(server.GetMyIP) to get the ip of the user but it returns the network local ip like 192.168.x.x , how can i get the real ip of the user ? Ty
Erel B4X founder Staff member Licensed User Longtime User May 8, 2018 #2 This is the real ip and the only ip address that is known to the device. If you want the external ip address then you need to use a web service that will return it. Example: Code: Copy Sub GetExternalIp As ResumableSub Dim j As HttpJob j.Initialize("", Me) j.Download("https://www.myexternalip.com/raw") Wait For (j) JobDone(j As HttpJob) Dim res As String = "" If j.Success Then res = j.GetString End If j.Release Return res End Sub Call it with: Code: Copy Wait For (GetExternalIp) Complete (Ip As String) Upvote 0
This is the real ip and the only ip address that is known to the device. If you want the external ip address then you need to use a web service that will return it. Example: Code: Copy Sub GetExternalIp As ResumableSub Dim j As HttpJob j.Initialize("", Me) j.Download("https://www.myexternalip.com/raw") Wait For (j) JobDone(j As HttpJob) Dim res As String = "" If j.Success Then res = j.GetString End If j.Release Return res End Sub Call it with: Code: Copy Wait For (GetExternalIp) Complete (Ip As String)