B4J Question ServerSocket.GetMyIP Returning wrong IP with Bridge?

jmon

Well-Known Member
Licensed User
Longtime User
When connecting with b4j-bridge to my raspberry pi, I end up with an unexpected behavior:

My RPI ip address is "192.168.1.39", but running this code on the RPI with b4j-bridge:
B4X:
Dim local As ServerSocket
local.Initialize(1, "")
Dim Host As String = local.GetMyIP
'= Host = "192.168.1.37"
returns "192.168.1.37", which is actually the IP address of my windows computer that runs B4J.

In my test, it seems that GetMyIp returns the ip of the B4J running the bridge, and not RPI's IP.

Is it normal? Is there a workaround?

Jmon

I tried this code: https://www.b4x.com/android/forum/threads/serversocket-getmyip-returns-wrong-ip.60071/#post-379128
but didn't work with B4J
 
Top