Still 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?
 

Reply via email to