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 / File sharing between devices

Author
Message
CodeTrasher
11
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 31st Oct 2012 07:49
Hello,

I have an app in mind which is going to need file sharing between to devices over a network. I'm planning to program it with AppGameKit but currently I don't have a solution for the file sharing issue. Is HTTP way to go or what? Thanks for any ideas =)

- CodeTrasher
CodeTrasher
11
Years of Service
User Offline
Joined: 18th Jul 2012
Location: Tampere, Finland
Posted: 11th Nov 2012 15:20
Please, can someone give any advice on this? I'm not that familiar with AppGameKit yet, and I don't know what kind of file sharing method to implement.

Regards,
CodeTrasher
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 12th Nov 2012 10:23
I send imaged from one device to another in my app. I do it by reading the image as a file and sending the data using the network message commands. At the other side, I write to a file to put it back together again.

The one downside to this is that you can only send data 4 bytes at a time as a minimum (float or integer). So, you can end up with up to 3 extra bytes in your file when you save it. For jpg and png, they are extremely forgiving and it works fine.

Now we can read files byte by byte (V108 Beta 3), I hope I can finetune this to send the exact data. It means that there will need to be some fiddling with the last 4 bytes sent, maybe somebody can enlighten us as to how to get individual bytes out of a 4-byte integer (bitwise operations?)

JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 12th Nov 2012 11:29
One thing to bear in mind is that byte-order and word-order may be different on different platforms, so shifts may be problematic. You may also be going from one flavour of machine to a different flavour.

I will ponder.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 12th Nov 2012 16:44
To get individual bytes, Tier 1 (Tier 2 is easier, it has hex values):


Cheers,
Ancient Lady
AGK Community Tester
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 12th Nov 2012 17:42 Edited at: 12th Nov 2012 18:32
At the moment, Intel and ARM are usually Little-endian (although ARM chips can be put into either mode by hardware or BIOS at power-up). So it may be reasonably safe these days to assume that it's least significant byte first.

Be aware, though, that Cray T3E processors can only run in Big-endian mode, and customers at the National Ignition Facility in California may be a bit upset if they test your shoot-em-up and send 500 trillion watts of energy down the local sewers.

I haven't looked at documents for the latest AppGameKit, but, surely, if you can send bytes the receiver can sort this out?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Nov 2012 17:51
Currently all the platforms we support are little endian

Login to post a reply

Server time is: 2024-05-07 16:15:02
Your offset time is: 2024-05-07 16:15:02