B4J Question How to get client ip

Darsiar

Member
I run the ABMaterial application on shared shared PHP hosting. Everything works great. Just put the www folder and index.html obtained after compilation from B4J

I am making a game tracker.
My page should get the IP address of the client, and first display it in a text box.
Please tell me which team B4J can calculate the IP address from which the request came to the page.
I do not use server libraries and web sockets, because I work under the Linux server of my provider.

Thank.
 
Last edited:

aaron_smith4

New Member
I needed the same for my project where I was using vuejs in the front end and node in the backend. I used ipify api to get the users IP address and show it. I'm sure you must be using either a javascript framework or atleast Jquery in the front-end. I used fetch API for my vue app.

fetch('api)
.then(x => x.json())
.then(({ ip }) => {
this.term = ip;
});
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I run the ABMaterial application on shared shared PHP hosting
I do not use server libraries and web sockets
You realize ABMaterial uses WebSockets.
Just put the www folder and index.html obtained after compilation from B4J
Are you saying you just copy the www folder without the .jar file? With ABMaterial, how does that work (the whole point is that the produced www content talks to the B4J server on the back end).
 
Upvote 0

Darsiar

Member
Yes I understand this!
I myself was very surprised when I put all the files, including the jar on a regular but clustered hosting and noticed that just accessing the file works ...
Then, the hoster wrote that I was doing something bad with its shared resource. And I removed it.
I myself did not understand anything))
 
Upvote 0
Top