Android Question Server by name and IP

jeronimovilar

Active Member
Licensed User
Longtime User
I´m tryng find the server using httpjob. By IP is working fine.
Why not using name server?
B4X:
    Dim ServerUrl1, ServerUrl2
    ServerUrl1 = "http://192.168.0.100/base.asp" 
    ServerUrl2 = "http://Intranet/base.asp" 
    Dim j As HttpJob
    'HttpJob
    j.Initialize("",Me)
    j.GetRequest.Timeout = 5000
    j.Download(ServerUrl1)  
    Wait For (j) JobDone(j As HttpJob)
 

drgottjr

Expert
Licensed User
Longtime User
the only way "Intranet" can be mapped (to an ip address) is if it appeared in /etc/hosts. you can edit/create /etc/hosts on a rooted device. maybe someone can tell you if it can be done on a non-rooted device;i don't think so.

another chance might be with one of those dynamic dns services (no-ip.com), but it will take some setting up. and "Intranet" as a server name is probably not enough.
 
Last edited:
Upvote 0

jeronimovilar

Active Member
Licensed User
Longtime User
I´m using IIS on Windows 10
My ip is dinamic and i can´t static becouse my pc/app is used in any differents routers.
What can i do on /etc/drivers/host?
 
Upvote 0

Xfood

Expert
Licensed User
sorry, I didn't understand, the server is on android?

if the server is on pc, you can use the nop-ip service,
and from android you connect with myip.no-ip.com
and you shouldn't have any problems
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

aeric

Expert
Licensed User
Longtime User
When a server name is use, what I have seen the use case is normally it is for web based or intranet client-server system which is accessible by web browser or desktop application and the IP of the server is set as static. All the computers connected to the same network can access the server.

If it is for development purpose, we can use a dynamic IP until the router reassign new IPs to all the connected devices through DHCP. Static IP may conflict when the order of assigning the IP changed. I only use mobile hotspot for development so my laptop, Android emulator or phone IP seldom change their IP. If changed occurred, it is easy to modify the IP in the app and IDE.

In case you want to use the app as production for long term, the client app may have problem to connect to the server if the server IP has changed and no longer same as the hardcoded IP in the mobile app.

As answered by other members, you can use no-ip or duckdns services. You get a fixed public IP which is tied to the server no matter the IP has changed dynamically.

If it is a long run production server, another way is host the server as public. If hosted on your own premise, there are some configurations to set such as port forwarding, firewall and IP or Mac Address whitelisting. You still need a static public IP. Normally I will better just get a shared hosting server with a register domain name.

This is what I know.
 
Upvote 0

jeronimovilar

Active Member
Licensed User
Longtime User
My server is PC (windows 10)
I´m travel for show my app and connect in differente routers.
any with internet access or no (intranet)
i´d like the my android app access my server/pc by name
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
i´d like the my android app access my server/pc by name
As mentioned a few times now: Use a no-ip Service!

BTW: If you are traveling and access to wifi with no internet: How do you want access your PC without Internet (even if you have no-ip-Service running you´ll get no route to it without internet)?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Another solution which I used before:

 
Upvote 0
Top