Reaching the URI


This is a question valid for 2 forums, so I am posting in this place.

In some cases I am using Aurelius with RemoteDB Client.

However there is a situation that I don't know how to handle seamlessly:

I have an internal server, ip where I have RemoteDB. I reach it with no problem and works.

It is requesting to map the URI like this: http://localhost:2001/nahar

And then the "/Database"

This server can be reached from outside by a port routing. Where all the 2001 port traffic is routed to 2001 port on this server.

When access from outside it does works fine also.

But the client can be accessing the same server from private and from the public network. and that is a problem. Using the public URI do not resolve to the local server.

How can I use RemoteDB client in order to get this connection work? I belive I need to save a pair of URI one private another public. But how to quickly find and switch with RemoteDB client?



If I understood correclty, this is not a RemoteDB or Sparkle question, but more network-related. Sparkle (and RemoteDB which is based on Sparkle) doesn't care about the server address. Actually when you register a module using "http://localhost:2001/nahar", the server name is the only part discarded by Sparkle, because it serves no purpose (only scheme (http), port and path are important).

I'm not sure how you can access a local server from your internal network using a public address, I think it's not possible or require some specific configuration in your network. Worst case you could use some configuration file and change the server address at runtime.

No, this is not network related only...

I am using Aurelius + RemoteDB client. And when gets to the point of connect there are some trouble around this.

This will be a pretty common scenario for smartphones and tablets, and I am trying to find a solution and at same time it will benefit your product.

My question is how to detect and quickly switch between 2 possible URIs when using RemoteDB as client with Aurelius. 

Hi Eduardo, I still don't understand. If you can programatically set the URI of your server address from Delphi code, what's the problem in changing the address from code?

nevermind, in the process of explaining I found a solution.

The problem is to switch between 2 URI, the private and the public, because the user can be using the internal WIFI network (private) and outside using Internet.

And in my code it is some classes aways from the TRemoteDBConnectionAdapter.Create(FXDB, true) and the moment that Aurelius do connect. 

At that point is hard to come back. So I was wondering if there is any mechanism or event or whatever that could be used to switch URI without breaking the calling stack. Since it is not a real error, the fact is that  you dont know previously which URI to use first.

Got it?

Kind of. What solution you found?