Why not try to pass the string as a fixed length string. Passing a pointer is rather
useless, since you are on another computer. The pointer is pointing to an address on
the sending computer. It obviously will not exist in the Server, and it is a wonder
you go not get an AV when you try to access the data the pointer is pointing to. Well
you would if you altered it.
Passing a standard delphi string is not good, since the sizeof(RecordStructure) uses
the sizeof a string which is a pointer type (I think).
eg:
type
MyRecord = Record
Num : Integer;
Str : String;
end;
MyRecord1 = Record
Num : Integer;
Str : String[50];
end;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(intToStr(SizeOf(MyRecord)));
ShowMessage(intToStr(SizeOf(MyRecord1)));
end;
The first showmessage shows 8, while the second shows 56. See if that helps you.....
Chris
Christopher Crowe (Software Developer)
Microsoft MVP, MCP
Adrock Software
Byte Computer & Software LTD
P.O Box 13-155
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Jeremy Coulter
> Sent: Wednesday, 14 April 1999 21:02
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Passing record structures
>
>
> Thanks, Nigel, BUT.....it send integers fine, but I am having problems
> getting it to pass the data in the pointer.
> It is populated when it leaves the client port, but when it come sin the
> server app's port, it is blank. As I say, the integer is passed ok...it
> MIGHT be the way I am receiving it....I am doing :-
>
> Sockets1.SReceive(Socket,@TestRec,len);
> memo1.lines.add(inttostr(TestRec.iMyInt));
> memo1.lines.add(strpas(TestRec.sMyCString));
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz