Sending records with Indy 10 : Problem with String

Giganews Newsgroups
Subject: Sending records with Indy 10 : Problem with String
Posted by:  Christian rodriguez (cdrodrigu…@ambimetrics.com)
Date: Sat, 4 Nov 2006

In Indy 10 I have the following code:

RECORD:
type
eje= packed record
  num:Integer;
  num2:Single;
  name:AnsiString;
end;

SENDER:

var
Buf: TIdBytes;
ori:eje;
Buf:=RawToBytes(ori,SizeOf(ori));
AContext.Connection.IOHandler.Write (buffer);

RECEIVER
var
buf:TidBytes ;
dest:eje;

AContext.CanalComandos.IOHandler.ReadBytes(buf,SizeOf(eje));
  BytesToRaw(Buf,dest,SizeOf(eje));

then, when I try to access de name field there is a access violation error.
If I use a record without a string field the transmission is successful.

I´m having also problems sending and receiving Objects, is there any
consideration to take into account???
Thank you very much in advance...

Replies