A Antonino Colomba Member Licensed User Oct 19, 2020 #1 Hi, I try to use " ServerSocket.GetMyIp " to find the IP Address. It works, BUT I have a strange problem: the variable I obtain is not a real String (?!?!) In fact in the debugger I see the variable having a subnode "value": for this reason I can't, for example, use a split function because I obtain a blank string. Someone can help me? Attachments errore.png 5.2 KB · Views: 670
Hi, I try to use " ServerSocket.GetMyIp " to find the IP Address. It works, BUT I have a strange problem: the variable I obtain is not a real String (?!?!) In fact in the debugger I see the variable having a subnode "value": for this reason I can't, for example, use a split function because I obtain a blank string. Someone can help me?
mcqueccu Expert Licensed User Longtime User Oct 19, 2020 #2 What are you expecting? Where is the code your code? Try this B4X: Dim MyLan As ServerSocket log(MyLan.GetMyIP) Upvote 0
What are you expecting? Where is the code your code? Try this B4X: Dim MyLan As ServerSocket log(MyLan.GetMyIP)
A Antonino Colomba Member Licensed User Oct 20, 2020 #3 the problem was not GetMyIP, but "Regex.Split".... this last don't work with "." So I resolved the problem replacing "." with "," Thanks Upvote 0
the problem was not GetMyIP, but "Regex.Split".... this last don't work with "." So I resolved the problem replacing "." with "," Thanks
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2020 #4 Antonino Colomba said: the problem was not GetMyIP, but "Regex.Split".... this last don't work with "." Click to expand... This is of course not correct. However we can't (and shouldn't try to) help when the relevant code is missing. Upvote 0
Antonino Colomba said: the problem was not GetMyIP, but "Regex.Split".... this last don't work with "." Click to expand... This is of course not correct. However we can't (and shouldn't try to) help when the relevant code is missing.
A Antonino Colomba Member Licensed User Oct 20, 2020 #5 B4X: Dim InterCon As ServerSocket InterCon.Initialize(0, "") Dim stringaIP As String = InterCon.GetMyIP stringaIP = stringaIP.Replace(".", ",") Dim arrPezziIP() As String = Regex.Split(",", stringaIP) this was my solution Upvote 0
B4X: Dim InterCon As ServerSocket InterCon.Initialize(0, "") Dim stringaIP As String = InterCon.GetMyIP stringaIP = stringaIP.Replace(".", ",") Dim arrPezziIP() As String = Regex.Split(",", stringaIP) this was my solution
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2020 #6 Correct code: Code: Dim InterCon As ServerSocket 'ignore 'no need to initialize ServerSocket if you are only using it to get the ip address Dim stringaIP As String = InterCon.GetMyIP Dim arrPezziIP() As String = Regex.Split("\.", stringaIP) Upvote 0
Correct code: Code: Dim InterCon As ServerSocket 'ignore 'no need to initialize ServerSocket if you are only using it to get the ip address Dim stringaIP As String = InterCon.GetMyIP Dim arrPezziIP() As String = Regex.Split("\.", stringaIP)
A Antonino Colomba Member Licensed User Oct 20, 2020 #7 I tryed Regex.Split("\.", stringaIP) but don't work :-( So I resolved using "Replace" Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 20, 2020 #8 Please take your time and test my answers. They are usually correct. Not always but in this case the answer is correct. Code: Dim s As String = "127.0.0.1" Dim parts() As String = Regex.Split("\.", s) For Each p As String In parts Log(p) Next Upvote 0
Please take your time and test my answers. They are usually correct. Not always but in this case the answer is correct. Code: Dim s As String = "127.0.0.1" Dim parts() As String = Regex.Split("\.", s) For Each p As String In parts Log(p) Next
A Antonino Colomba Member Licensed User Oct 20, 2020 #9 I tryed it... and i tryed again in my code and now... It's work!! I don't understand... Only explanation: perhaps I used "/" instead of "\" Thank you. Upvote 0
I tryed it... and i tryed again in my code and now... It's work!! I don't understand... Only explanation: perhaps I used "/" instead of "\" Thank you.