Pull Data from Desktop App

Hey all,

I want to pull some data from a desktop app to my iOS app. Ideally, I would like to send an entire database file. If I knew my clients were all using Apple desktops, I could use iCloud to access the file, but that is not the case. So I need to somehow do it between the two apps. My thought is to use a TCP connection and send over the records row by row and table by table. Seems somewhat laborious. I’m wondering if someone has developed a class for sending entire files.

Ideas?

Jon

EasyTCPSocket makes sending files pretty easy

That’s not available on iOS.

[quote=477039:@Jon Ogden]Hey all,

I want to pull some data from a desktop app to my iOS app. Ideally, I would like to send an entire database file. If I knew my clients were all using Apple desktops, I could use iCloud to access the file, but that is not the case. So I need to somehow do it between the two apps. My thought is to use a TCP connection and send over the records row by row and table by table. Seems somewhat laborious. I’m wondering if someone has developed a class for sending entire files.

Ideas?

Jon[/quote]
If it’s not a huge amount of data, you could convert your database into a series of JSON strings and transfer those. They would at least have some structure.

Just thinking this through… both platforms support sqlite. Could you just transfer the file by reading it with a binarystream, transfer through a TCPSocket, and then write on the iOS side with a binarystream?

It is actually in the examples folder! It works fine on LAN with the correct plist entries

I’ve not done this in Xojo for iOS, but I routinely do it in another platform. As Greg notes, both platforms support SQLite. So what I do is create the database to send to the other side, then to reduce transfer time, I zip the SQLite file. It gets transferred over HTTPS, then on the iOS side I unzip the file and store on the device where I just open as a SQLite database.

I realize this answer does not give explicit instructions on how to do it via Xojo; it is meant more as a validation of the concept. And to suggest you zip or gzip the transfer to make it faster. (Perhaps not necessary if the data is small enough, but it is a step I do.)

I was thinking this as well as your JSON idea.

The question I had was the database is encrypted. Will the encrypted file transfer properly? I suppose if I make a smaller database of just what I need, I could send it unencrypted.

OK. Thanks for the help, guys.

[quote=477097:@Douglas Handy]I’ve not done this in Xojo for iOS, but I routinely do it in another platform. As Greg notes, both platforms support SQLite. So what I do is create the database to send to the other side, then to reduce transfer time, I zip the SQLite file. It gets transferred over HTTPS, then on the iOS side I unzip the file and store on the device where I just open as a SQLite database.

I realize this answer does not give explicit instructions on how to do it via Xojo; it is meant more as a validation of the concept. And to suggest you zip or gzip the transfer to make it faster. (Perhaps not necessary if the data is small enough, but it is a step I do.)[/quote]
Thanks. I could probably send via TCP. I don’t know if I need to zip it or not as I don’t have that much data, but I will think about it.

Huh. I never thought to look there.

I’d have some doubts about the stability of your solution in practice. Pulling data of clients and peer to peer networking for public clients are things that security types work hard to lock down… making machines undiscoverable and preventing machines from accepting incoming requests is how we lock down and secure machines, yet to succeed you are going to need the opposite…

I would expect that introduction a server into the equation would result in a simpler and more stable solution. It only costs a couple of dollars a month and users tend to be very motivated to make sure their internet connection is working.

We all learn every day…:wink:

[quote=477155:@James Dooley]I’d have some doubts about the stability of your solution in practice. Pulling data of clients and peer to peer networking for public clients are things that security types work hard to lock down… making machines undiscoverable and preventing machines from accepting incoming requests is how we lock down and secure machines, yet to succeed you are going to need the opposite…

I would expect that introduction a server into the equation would result in a simpler and more stable solution. It only costs a couple of dollars a month and users tend to be very motivated to make sure their internet connection is working.[/quote]

Actually, the TCP connection works quite well. Didn’t take me that long last night to do it. There’s zero need for a server and transference over the internet of this data which would be a less secure method. There’s nothing in the data being transferred that is “user” data. I am not going to try to explain or defend what I am doing because you have a mindset based on over-complication of things.

Suffice to say a sever approach would be so wrong for what I am doing.

and how about access this file via network drive in LAN? (file share)
at windows exists UNC path, don’t know if macOs and iOS have similar.
was apple not the first one that provide file sharing from one pc to other pc? was everything replaced with iCloud Service?

[quote=477178:@Markus Rauch]and how about access this file via network drive in LAN?
at windows exists UNC path, don’t know if macOs and iOS have similar.
was apple not the first one that provide file sharing from one pc to other pc? was everything replaced with iCloud Service?[/quote]

That’s even more complicated.

No, making a simple peer to peer connection works quite well.

I am using Valentina sqlite server with rest api and is working perfects.
thanks to all help and Valentina supports

[quote=477180:@Alexis Colon Lugo]I am using Valentina sqlite server with rest api and is working perfects.
thanks to all help and Valentina supports[/quote]

Again, way more complicated. Sometimes in life, the simplest solution is the best.

you can try to put the DB in BLOB column in the desktop db server then download in the iOS app and then open the DB local in iOS.

OK. Thanks for all the advice people, but I have the problem solved. A peer to peer transfer works quite easily. I already have a TCP based API on my desktop app. I had a to add a few lines of code and now I can easily send what I need to the iOS app. No need to go out over the public internet. No need to have a server. No need to have any weird machinations. Greg’s solution was the simplest and best.

[quote=477179:@Jon Ogden]That’s even more complicated.
No, making a simple peer to peer connection works quite well.[/quote]
if this is the case also at all your clients, great.