Delphi XE Datasnap 中的传输过滤器

发布于 2024-10-01 14:20:38 字数 196 浏览 7 评论 0原文

当我尝试为 datasnap 创建自定义传输过滤器并使用它时,当我运行客户端应用程序时,我收到一条错误消息:

模块 ProjectAdminClient.exe 中出现异常 TDBXError。 Filter Log Rejected 设置参数 FilterUnit 给定值 1024。 此时,由于不兼容,服务器通信无法进行。

是什么原因造成的?

When I try to create a custom Transport Filter for datasnap and use it, when I run the client app i get an error stating:

Exception TDBXError in Module ProjectAdminClient.exe. Filter Log Rejected setup parameter FilterUnit given value 1024. At this point the server communication is not possible due to this incompatibility.

What is causing this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

路弥 2024-10-08 14:20:38

您使用过滤器参数吗?我还创建了自定义传输过滤器,但从未遇到过此错误。这是一个不执行任何操作的日志过滤器示例...

unit LogFilter;
interface
uses
  SysUtils, DBXPlatform, DBXTransport;

type
  TLogFilter = class(TTransportFilter)
  public
    constructor Create; override;
    destructor Destroy; override;
    function ProcessInput(const Data: TBytes): TBytes; override;
    function ProcessOutput(const Data: TBytes): TBytes; override;
    function Id: UnicodeString; override;
  end;

const
  LogFilterName = 'Log';

implementation
uses
  CodeSiteLogging;

constructor TLogFilter.Create;
begin
  inherited Create;
  CodeSite.Send(csmBlue,'TLogFilter.Create');
end;

destructor TLogFilter.Destroy;
begin
  CodeSite.Send(csmBlue,'TLogFilter.Destroy');
  inherited Destroy;
end;

function TLogFilter.ProcessInput(const Data: TBytes): TBytes;
begin
  Result := Data;
  CodeSite.Send(csmYellow, 'ProcessInput ' + IntToStr(Length(Data)),
    TEncoding.ASCII.GetString(Data));
end;

function TLogFilter.ProcessOutput(const Data: TBytes): TBytes;
begin
  Result := Data;
  CodeSite.Send(csmOrange, 'ProcessOutput ' + IntToStr(Length(Data)),
    TEncoding.ASCII.GetString(Data));
end;

function TLogFilter.Id: UnicodeString;
begin
  Result := LogFilterName;
end;

initialization
  TTransportFilterFactory.RegisterFilter(LogFilterName, TLogFilter);
finalization
  TTransportFilterFactory.UnregisterFilter(LogFilterName);
end.

这个对我来说效果很好(我即将推出的 Delphi XE DataSnap Development Essentials 课件手册中的示例之一)。

鲍勃·斯沃特·格鲁特耶斯

Are you using Filter parameters? I've also created custom transport filters, but never encountered this error. Here's an example do-nothing log filter...

unit LogFilter;
interface
uses
  SysUtils, DBXPlatform, DBXTransport;

type
  TLogFilter = class(TTransportFilter)
  public
    constructor Create; override;
    destructor Destroy; override;
    function ProcessInput(const Data: TBytes): TBytes; override;
    function ProcessOutput(const Data: TBytes): TBytes; override;
    function Id: UnicodeString; override;
  end;

const
  LogFilterName = 'Log';

implementation
uses
  CodeSiteLogging;

constructor TLogFilter.Create;
begin
  inherited Create;
  CodeSite.Send(csmBlue,'TLogFilter.Create');
end;

destructor TLogFilter.Destroy;
begin
  CodeSite.Send(csmBlue,'TLogFilter.Destroy');
  inherited Destroy;
end;

function TLogFilter.ProcessInput(const Data: TBytes): TBytes;
begin
  Result := Data;
  CodeSite.Send(csmYellow, 'ProcessInput ' + IntToStr(Length(Data)),
    TEncoding.ASCII.GetString(Data));
end;

function TLogFilter.ProcessOutput(const Data: TBytes): TBytes;
begin
  Result := Data;
  CodeSite.Send(csmOrange, 'ProcessOutput ' + IntToStr(Length(Data)),
    TEncoding.ASCII.GetString(Data));
end;

function TLogFilter.Id: UnicodeString;
begin
  Result := LogFilterName;
end;

initialization
  TTransportFilterFactory.RegisterFilter(LogFilterName, TLogFilter);
finalization
  TTransportFilterFactory.UnregisterFilter(LogFilterName);
end.

This one works just fine for me (one of the example from my upcoming Delphi XE DataSnap Development Essentials courseware manual).

Groetjes, Bob Swart

深白境迁sunset 2024-10-08 14:20:38

当我使用 Bob 博士的 Delphi 2010 Datasnap 白皮书中的 LogFilter 遇到类似问题时,我发现了这个问题。

问题(至少部分是)是我在尝试使用日志过滤器的同时加载了 ZLibCompression 过滤器。线索是在 ServerContainerUnit1.dfm 中,

Filters = <
  item
    FilterId = 'ZLibCompression'
    Properties.Strings = (
      'CompressMoreThan=1024')
  end>

我看到 1024 也在错误中,并认为在没有 ZLib 过滤器的情况下值得尝试。我从客户端和服务器中删除了它。现在日志过滤器可以工作了。我获取服务器时间并在 LogFilter 代码中设置断点。

I found this question when I had a similar problem using Dr Bob's LogFilter from his Delphi 2010 Datasnap Whitepaper.

The problem, at least partially, is that I had the ZLibCompression filter loaded at the same time I was trying to work with the log filter. The clue was in the ServerContainerUnit1.dfm

Filters = <
  item
    FilterId = 'ZLibCompression'
    Properties.Strings = (
      'CompressMoreThan=1024')
  end>

I saw the 1024 which was also in the error and figured it was worth trying without the ZLib filter. I removed it from the client and server. Now the log filter works. I get the server time and get breakpoints to work in the LogFilter code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文