How to make an Auto Discover App on the network

EduardoElias

Well-Known Member
Licensed User
Longtime User
Hi there!

I wonder if someone could give me a direction about how to make a auto discover funtion for my app.

I believe this need to be done with basic socket functions, but i have no clue on that right now.

I have a server written in delphi that is a http server that provides webservice access. It is in the same network. My common hardware setupe is a Wifi router with a server on a PC and 2 or 3 tablets android with my app.

What I want is to discover the server, that can eventually have the ip changed due the boot order with the router DHCP. I want to make that transparent for the user, when in the same network.

Please, if that helps, consider the server like an b4a android app. I want to understand what I have to do on the b4a side and I try to do the same on delphi, where I have many option. I have a full range of network servers protocols available.

Many thanks

Eduardo Elias
 

EduardoElias

Well-Known Member
Licensed User
Longtime User
Thank you for the answer.

I have already a screen for configurarion of the ip.

But regular users does not know what IP means at all. And many other troubles with server config. My target user has a server that is basically a regular windows desktop (XP mostly) that is used to hold the database. It is technically a server, but no IT structure at all.

There are other software supliers to these companies, and even the Internet ISP, that install stuff and change configs, Static Ip mostly of the time is changed back to dynamic.

I was wondering if there is any protocol that could be used to broadcast, but that is part of the b4a tools. For example, DHCP is auto discoverable, there are others like that, on PC side is not difficult to find that.

That is getting important to me. Not sure if I could do a IP scan, that would be up to 256 tests to find a server to answer.

Thank you
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
The ISP is not relevant if the server is accessed over the local network.

Yes i know it is not relevant.... Sorry my english is not good and sometimes i do not express myself good.

I meant that the guys from ISP change network configurations without asking anything. If i put in static they change back to dynamic, and other software supliers do the same. Since there is no IT guy responsabible. It is medium to small companies. The configuration needs to me more plug and play than anything, or it will be sure to have a lot of phone calls.

Thanks
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
I'm sorry but I'm not familiar with any "simple" solution.

Erel,

I am sharing here also might be useful for someone else:

This is the solution:
http://www.b4x.com/forum/additional...library-v1-10-udp-supported-5.html#post159148

I have made the changes needed and it is working.

The UDP broadcast gets listeneded on all devices on the local network (will not cross routers). THen in the server I have added a listener (in my case Indy TidUDPServer class) to listen on the port 4444 (same as apk service is broadcasting.

RIght now I made a timer for broadcasting to give some tries, however I believe only once try is needed, it should not have packet loss. However it should be trying if the server is not available (PC reboot, wifi reboot due powerfailure, etc)

It is very interesting way, again on the same network, to share messages and information. THe other androids are getting the messages as well.

Eduardo Elias
 
Upvote 0
Top