mrdnote
asked on
Shutting down application on pipes message
Hi, I'm trying to use rlibby's TPipeServer/Client components for interprocess communication. In this case I want to shut down the server application upon receiving the message 'QUIT'. This causes problems because the pipeserver component does not seem to handle it very well when it is being destroyed while handling a message. It causes an access violation in ntdll read of address 00000010.
Does anyone have a solution on how to do this, maybe by changing the code on the message recieving end, or by modifying the pipe component?
Also see the related question on how to get the pipes components working.
Im using Delphi 2009 v12.0.3210.17555 and the pipes components of 10.20.2008.
Does anyone have a solution on how to do this, maybe by changing the code on the message recieving end, or by modifying the pipe component?
Also see the related question on how to get the pipes components working.
Im using Delphi 2009 v12.0.3210.17555 and the pipes components of 10.20.2008.
Procedure TForm1.PipeServer1PipeMessage(Sender: TObject; Pipe: HPIPE; Stream: TStream);
var S: AnsiString;
begin
SetLength(S, Stream.Size);
Stream.Read(S[1], Length(S));
if (S = 'QUIT') then
begin
PipeServer1.Active := false;
Close; // causes access violation in pipeserver component!
end;
end;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what does the stack trace tell you ?
press - Ctrl-F3 to see what originated a procedure.
That could tell you what the cause of the violation is.
Check all procedures in this list to see if they don't access a component which has been freed allready.
You may have to press F7 once, to get a decent stack trace.
press - Ctrl-F3 to see what originated a procedure.
That could tell you what the cause of the violation is.
Check all procedures in this list to see if they don't access a component which has been freed allready.
You may have to press F7 once, to get a decent stack trace.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER