Frage

We have developed a client app and a server app. The client communicates with the server using the http protocol and sends some data to be processed by the server.

Our structure allow us to have the server installed anywhere. I can be on the same client network or even on the cloud.

When the server is hosted on the cloud, it makes sense asking the user for the server address (since it can change if the user wishes to) but it does not make sense when the server is on the same network that the client. Besides that, we are currently asking users to configure the server ip/name in order to connect to the server.

To avoid this (asking users for the address) I have developed a discovery service based on UDP. The client broadcasts a message that the server answer with its address. It does work on some cases, but it does not when the user has some kind of firewall, proxy or even an anti virus.

I have read a lot about discovery services, and the one that a like most is Bonjour.

So, the question is: what is the best way of discovering a server's IP when the server is on the same network that the client without being blocked by firewalls, proxies, etc?

War es hilfreich?

Lösung

You can keep your service purely local (in the intranet) and build on top of what you are using now by implementing hole punching. You can get past firewalls, but Im really not sure about AV software policies.

Or you can establish a well-known http-based discovery service in the internet.

  1. A server comes alive, sends its (local) ip address to the discovery service (keeps sending keep-alives)
  2. On startup, the client queries that discovery service, identifies the local subnet he is in, and gets back the local ip address of the server.

That of course creates a single point of failure in your system in that if the discovery service kicks the bucket, your clients cannot find servers. You can remedy that by replicating the service and/or introducing fallback mechanisms (like the purely local discovery you have), which you probably want to do anyway. The only problem you might have is the subnet identification, if computers in local subnets dont share external IP addresses (then it depends on what a local subnet is for you).

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top