You can use this code to bind the serversocket to a specific ip address:
B4X:
Sub InitializeWithIp(Server As ServerSocket, EventName As String, Port As Int, ip As String)
Server.Initialize(0, EventName)
Dim ia As JavaObject
ia = ia.InitializeStatic("java.net.InetAddress").RunMethod("getByName", Array(ip))
Dim s As JavaObject = Server
Dim socket As JavaObject
socket.InitializeNewInstance("java.net.ServerSocket", Array(Port, 50, ia))
s.SetField("ssocket", socket)
End Sub
Example:
B4X:
Dim ServerSocket1 As ServerSocket
InitializeWithIp(ServerSocket1, "ServerSocket1", 55555, "127.0.0.1")