Andrzej Miechowicz 0 Posted April 30, 2020 My Datasnap server is installed on one of the computers in my local network. I do not know how to share it. I want to access it from the program located on remote server. Is it possible to simply share it without installing Apache or another web tools? Thanks in advance! Share this post Link to post
Tom Chamberlain 47 Posted May 1, 2020 What type of Datasnap server did you make? Standalone EXE (GUI), Windows Service, IIS DLL or Apache module? If it's an IIS DLL or Apache module, then yes you will need the matching IIS or Apache server installed. Is it a EXE or Windows Service, then it run it or install the service and start it. What are you wanting to do with it, simple remote dataset access, remote method calls, passing objects, register and call backs or what? Have you tried the demos and http://docwiki.embarcadero.com/RADStudio/Rio/en/Tutorial:_Using_a_DataSnap_Server_with_an_Application is a good starting point. Share this post Link to post
Andrzej Miechowicz 0 Posted May 1, 2020 (edited) Thank you for response. I have written DataSnap server (Delphi Rio, Firedac) as an exe file. It is located on the cloud server and works ok. I call it from Android Firemonkey application. Application needs to display some data from database. My DataSnap connects easily to SQL server database located on another cloud server: I specify IP, port, database, username, password. But now I need to connect DataSnap to Firebird, which is installed on the computer in another local network. I know external IP of this local network, I know internal IP of the local computer. But I do not know, if it is possible to connect it from outside of local network. How can I share it? What should I put into connection params? I was thinking about installing another Datasnap server - on the local computer. And connect it instead of Firebird. I prepared an image - I hope it better shows my connection problem. Edited May 1, 2020 by Andrzej Miechowicz Impoved Image Share this post Link to post
Hans J. Ellingsgaard 21 Posted May 1, 2020 You will need a vpn connection between the datasnap server and the local network. SQL queries over an internet line is very slow, but if it's only a few records, maybe you can live with it. You would be better of writing some REST services to communicate between the two hosts. Share this post Link to post
Andrzej Miechowicz 0 Posted May 1, 2020 Thank you for your advice. I would not like to use vpn. I want to create service (client service for DataSnap server), install it in local network and use it to connect to remote DataSNAP server. The problem appears, when Android application needs for example to get a list of customers from local computer. Android Application sends a request to DataSnap server, but how to retrieve them from local database? I can prepare local service (client side), but how to inform it, that the server needs data? I can force local service to check every second if the server has new request, but is it a good solution? Share this post Link to post
Uwe Raabe 2057 Posted May 1, 2020 11 hours ago, Andrzej Miechowicz said: I know external IP of this local network, I know internal IP of the local computer. If you have a static IP in your local router, you can add a port forwarding in the router to the FireBird server. This allows the FireBird server to be accessed from outside your local network. Note that this is actually opening up your local network to the Internet, so you need some expertise to setup all this in a safe and reliable way. If you are not familiar with the terms mentioned above, I suggest asking for professional help. Share this post Link to post
Tom Chamberlain 47 Posted May 2, 2020 Never directly expose a database server of any kind to the internet, you are just asking for trouble. Like Hans said a REST service would be better but a VPN connection would be best. You may be able to do a DataSnap server on the local network and make request to it from the outside and have it talk to the FireBird server but you should look at doing it through IIS or Apache and using an SSL certificate to protect your data. Are you using some type of encryption or SSL cert when talking with the Andriod app? 1 Share this post Link to post
aehimself 396 Posted May 2, 2020 A VPN is overkill in my opinion; a simple port forwarding is sufficient. Even if you have dynamic IP addresses there are free / cheap solutions to tie that to a domain name (just google for free dynamic dns). But as @Tom Chamberlain mentioned, it is a REALLY bad idea to directly expose a database to the Internet, so definitely do use a REST-like server in between. Share this post Link to post
Andrzej Miechowicz 0 Posted May 2, 2020 Well, Android app communicates with DataSnap Server using PC1 and RSA encryption via TCP/IP (it is not REST Server). You are right: exposing Firebird database online it is not a good idea (I was rather thinking about separate service, which would provide the handle to connect it and care about encrypted and safe communication). But the main point is to send request from server (DataSnap server) to client (service on then computer with Firebird database) 1) Android sends a request to DataSnap server to get customer list. 2) DataSnap informs a "Firebird-similar-service", that it should send him back the customer list. But Firebird-similar-service is client - not server. It is not listening, but it is sending requests to the server. How to inform it, that is should prepare same data and send it to the server? Share this post Link to post
Uwe Raabe 2057 Posted May 2, 2020 You might have a look at DataSnap Callbacks then: http://docwiki.embarcadero.com/RADStudio/Rio/en/DataSnap_REST_Messaging_Protocol#Heavyweight_Callbacks Share this post Link to post
Andrzej Miechowicz 0 Posted May 2, 2020 Thank you! I think this is what I am looking for. Probably I should redesign my DataSnap server from TCP/IP to REST technology and finally use callbacks. Share this post Link to post
pcplayer99 11 Posted May 3, 2020 Your issue is: A server working in a LAN server which has a private IP address, and your client want to access from Internet. If your LAN has a Internet router, and if you can setup the port mapping of this router, then your client can access your server from Internet. This is a simple diagram of port mapping: Internet -- xx.xx.xx.xx(Your router's public IP address) --- (port 8888: 192.168.1.20:9999 -- this is the port mapping setup in your router) --- Your Server on 192.168.1.20:9999. If your router's public IP address is dynamic, you will using some dynamic DNS services to let a fixed DNS name point to your dynamic IP address. Share this post Link to post
Andrzej Miechowicz 0 Posted May 4, 2020 Thank you - my question started from this problem and thank you for the explaining it. I have no access to the router setup and I would not like to have it. I just want to display in Android app some data stored in local network. Without dynamic DNS and changing network configuration (one exception in Firewall for the service, which will share data). Today I think the callbacks from the server are the solution. Share this post Link to post
pcplayer99 11 Posted May 5, 2020 Hi, OK, you can not setup router. Then you must have a server on the Internet that your LAN APP and your Android APP can get connected. This is not about callbacks or other tech. This is about how tow to establish communication between two device. Under normal conditions, to establish connection between two device, there must be a server, both device connect to this server, this server is working as a bridge. 1 Share this post Link to post