checkipcserver.lpr 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. program checkipcserver;
  2. {$mode objfpc}{$H+}
  3. uses
  4. {$IFDEF UNIX}{$IFDEF UseCThreads}
  5. cthreads,
  6. {$ENDIF}{$ENDIF}
  7. Classes, SysUtils, CustApp, simpleipc
  8. { you can add units after this };
  9. type
  10. { TSimpleIPCClientApp }
  11. TSimpleIPCClientApp = class(TCustomApplication)
  12. protected
  13. procedure DoRun; override;
  14. public
  15. constructor Create(TheOwner: TComponent); override;
  16. end;
  17. { TSimpleIPCClientApp }
  18. procedure TSimpleIPCClientApp.DoRun;
  19. var
  20. IPCClient: TSimpleIPCClient;
  21. begin
  22. IPCClient := TSimpleIPCClient.Create(nil);
  23. IPCClient.ServerID:= 'ipc_test_crash';
  24. if IPCClient.ServerRunning then
  25. WriteLn('Server is runnning')
  26. else
  27. WriteLn('Server is NOT runnning');
  28. IPCClient.Destroy;
  29. Terminate;
  30. end;
  31. constructor TSimpleIPCClientApp.Create(TheOwner: TComponent);
  32. begin
  33. inherited Create(TheOwner);
  34. StopOnException:=True;
  35. end;
  36. var
  37. Application: TSimpleIPCClientApp;
  38. begin
  39. Application:=TSimpleIPCClientApp.Create(nil);
  40. Application.Title:='IPC Client';
  41. Application.Run;
  42. Application.Free;
  43. end.