Ok, this was my first thought, but then when I was then put off by 2
points....(1). comments people made about apssing strings, and (2). I dont
know how big the data I am sening back is.
I can do "string[255]" for example, BUT the data i want to passback might be
30 or 4 database records, which has a size of 1500 chars.
I could do it all in a loop that sends packets of 255 chars, and since I am
passing a record structure, it could pass the number of chars in the packet
being sent, and if it reads "0" then the packet has finished sending, and
deal with it at the server or client end.
well I can try it anyway.....
Thanks, Jeremy Coulter
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Chris Crowe
> Sent: Wednesday, April 14, 1999 21:20
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: Passing record structures
>
>
> 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
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz