Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How do you copy a file over a Network?

Author
Message
Rudders
13
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 21st Feb 2013 15:14
Can some kind person give me some direction on how to simply copy a file to a device over a network...

The file will be at a specified path on a PC, I would like to copy the file across a network (wired or wi-fi) to the device runing the AppGameKit program and store in the devices AppGameKit resources folder.

Reason: I am copying a CSV file created by a windows program from a PC and importing the data into my App. Eventually I will need to copy a different processed CSV file from my devicew back to the PC.

Any code pointers much appreciated.
Talairina
19
Years of Service
User Offline
Joined: 9th Jan 2006
Location: United Kingdom
Posted: 21st Feb 2013 16:48
Pulling a file from a PC directly I believe is impossible under the current command set, although I could be wrong of course.

However you could upload the file to a webserver under your control and use the HTTP command's to download it to the device. At which point you can then upload the same/different file back to the webserver and bring it down the PC.

This does mean additional action's on your part at the pc to retrieve or update the files on the webserver.
Rudders
13
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 22nd Feb 2013 09:20
Thanks
Markus
Valued Member
21
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 22nd Feb 2013 09:40 Edited at: 22nd Feb 2013 09:40
for http you need a webserver, thats very much overhead.

why not transfer your data with agk?
here is a network example.

the client can send a file request message,
the pc read the file and send it as message back to your app.
you can save it or use it direct at client.

Rudders
13
Years of Service
User Offline
Joined: 20th Jan 2012
Location: Oxfordshire UK
Posted: 22nd Feb 2013 13:24
Thanks Markus, clear as mud but I will work through the code to understand, much appreciated.

I have tried using GetHTTPFile() but there seems to be a problem with this command as it does not detect if the file requested is not there and always creates the 'save' file irrespective?

Will have to bring this up on a new Forum Thread...

Thanks Again
DennisW
16
Years of Service
User Offline
Joined: 15th Jun 2008
Location: Ohio
Posted: 22nd Feb 2013 15:48
I use synctoy from Microsoft I keep my laptop up to date with what I am doing on my desktop. SyncToy2.1

Ham and Eggs Breakfast
The Chicken was involved the Pig was Committed
AGK Community Tester
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Feb 2013 23:39
Markus, you have a similar issue there to one I have.

You can only send 4 bytes as the smallest piece of data, because you can't send a byte.
I have got away with this because I am sending JPGs and PNGs, and they are very tolerant of up to 3 extra bytes of data. But something like a CSV file may not be.

Markus
Valued Member
21
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 25th Feb 2013 13:09
@BatVink
transfer with TCP send allways more because it send
the whole file or data in packages.
you can read 4 bytes and save only 3 bytes as file.
the first message should describe the lenght of data,
and can include the first block of it.
(i see also that agk have some unaccustomed limitations.
in other languages i can send a whole file in one message.)
the build in file functions are very good to save in a binary format
but i don't know if he want edit the csv file at the client.

Login to post a reply

Server time is: 2025-05-21 21:51:21
Your offset time is: 2025-05-21 21:51:21