EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TMCMessage.Data and Structured Record

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#11715
Posted: 11/17/2009 12:29:43
by Zane LEO (Standard support level)
Joined: 04/16/2006
Posts: 8

I have a number of structured records in my Delphi 7 app that I want to use as content for my message data in a MsgConnect app.

My questions are:

1. is there a record type (other than DataTree) in MsgConnect
2. if it is posible how would I pack and unpack a record using TMCMessage.Data.

simple message:
Code
type
  TApp_TXN = record
    ProcID,
    Request,
    Result
      :widesrting;
  end;


TIA

Zane
#11718
Posted: 11/17/2009 13:10:10
by Eugene Mayevski (EldoS Corp.)

Any streaming of records requires serialization support, i.e. you need to write code for writing down the record into stream and loading the record from stream. Classes and objects help doing this (by incapsulating methods that deal with the class), so instead of records we recommend using classes.

One of the methods of serialization is the use of RTTI and published properties, but this is probably an overkill in your case.

The simpliest method is to have something like this:

Stream.Write(@App_TXN.ProcID, sizeof(TApp_TXN));

BUT you can't do this with string and pointers inside of the record. If you have them, then your only choice is to write records one by one.

MCDataTree is a handy (though not very fast if you have lots of data) way to save the data. It can work in binary format to be more efficient.

Another format for structured data streaming is ASN.1, but this is a bit complicated format with little support. It's widely used in PKI and in our SecureBlackbox product.


Sincerely yours
Eugene Mayevski
#11752
Posted: 11/18/2009 21:45:32
by Zane LEO (Standard support level)
Joined: 04/16/2006
Posts: 8

Thanks for the advice.

When you state
Quote
BUT you can't do this with string and pointers inside of the record
do you mean if a single record is sent in ome message or does this only apply to multiple records sent in one message

TIA

Zane
#11754
Posted: 11/19/2009 00:31:29
by Eugene Mayevski (EldoS Corp.)

You can't save the record with a call to Stream.Write (as specified above) if your record contains pointers (PChar, for example) or string fields, for the simple reason that when you do this, you write not the data, but a reference to it and this makes no sense.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 3161 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!