Thanks
for that:
ms.SetSize(SizeOf(Packet)+1)
;
Size
:= ClientWSocket.Receive(ms.Memory,
SizeOf(Packet)+1) ;
Dave.
-----Original Message-----
From: Myles Penlington [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 November 2002 9:19 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Indy Client/ServerThis line is wrongSize := ClientWSocket.Receive(@ms, SizeOf(Packet)+1) ;Should be passing something like @Ms.Buffer and you may need to first allocate the buffer before passing it in. - Set its capacity I think.Myles.-----Original Message-----
From: David O'Brien [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 27 November 2002 9:15 a.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: Indy Client/ServerStill having problems with this socket app. I am now using ICS for the socket components after giving up on Indy.I am writing a TMemorystream to the socket at the client end, and reading into a TMemorystream at the server end.procedure TClientThread.ServerWSocketDataAvailable(Sender: TObject; Error: Word);
var
Command: Byte ;ms: TMemoryStream ;
begin
ms := TMemoryStream.Create ;
try
Size := ClientWSocket.Receive(@ms, SizeOf(Packet)+1) ;
if Size > 0 then
begin
ms.Seek(1, soFromBeginning) ;
ms.Read(Command, SizeOf(command)) ;SizeOf(Packet) is the max size I expect in. Size shows the correct size for the structure I have sent.The ms.Seek line fails with "Access violation at 0x77f60b77: write of address 0x00ae0ffc"Any ideas?