For achive sake, here's my solution. I chose to beam complete or partial DB's the same way. This make reception standard.
I put the name of the target DB into the scoket.name field. I beam the length of the AppInfoBlock, followed by the block itself. I then repeat the same process for every record I want to send. On the receiving device, I create a DB with socket.name, read 2 bytes (the length of the chunk), and then the chunk itself. The first chunk is the AppInfoBlock, others are records. I repeat the process until there's no more data coming, writing records one after the other into the DB. At the end of the process, I have a normal DB, not a file stream. Writing is probably a little more time-consuming with a DB than with a file stream, but when it comes to merging the received data with an existing DB, the beamed DB can be read just by locking a record handle, while a reading a record stored into a file stream would need to be moved into a buffer. End of this monologue thread! -- Luc Le Blanc I wrote earlier : > I wrote earlier : > > > Is the data stream format used by ExgDBWrite published? My app has to > > beam either a whole DB or a subset of it. Even in the latter case, I > > must send the AppInfoBlock along with the selected records. If I could > > emulate ExgDBWrite when beaming a subset of the DB, the receiving device > > could always use ExgDBRead, no matter what case I'm in. Otherwise, since > > my records are variable sized, I will have to prefix every ExgSend block > > with length info to allow splitting the resulting file stream. > > According to > http://www.palmos.com/dev/support/docs/fileformats/PDB+PRCFormat.html, > "If you have a chunk of data on the handheld device that is formatted as > described in this chapter, you can use either the DmCreateDatabaseFromImage > function or the ExgDBRead function to convert that data into a Palm > Database." > > So if I write the DB as a flat file, things shall be with ExgDBRead. But > given that I must build the header block before writing the records, I > wonder if it's not more trouble than just packing the records one after the > other with a length info between each ;) > > > How can I control the name of the DB received with ExgDBRead? Does it > > have to be the same as what is sent by ExgDBWrite or can it be changed > > along the way (in the socket maybe)? > > I'll try changing the name in the socket, just to see. > > -- > Luc Le Blanc -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
