1

我有一个简单的移动应用程序,它拍摄一系列照片并通过 SendStream() 将其发送到连接的配置文件。

myTetherAppProfile.SendStream(myTetherManager.RemoteProfiles[idConnected],
                              'ImageData',
                              bmpStreamData);

这里发生的问题是接收器应用程序没有根据连接强度获取所有图像流(接收器应用程序上没有触发 ResourceReceived-Event)。

如果我收到交付失败的响应,这将没有问题。但我不明白这一点(SendStream()返回“真”)

除了实现“如果您收到我的图像,请用另一条消息回答”功能之外,是否有可能实现即使连接不良也能实现稳定传输?还是 App-Tethering 默认设计为有损?

同样在一大堆图像之后,我有时会收到“对等方重置连接”错误。(我不确定这个错误是否与实际问题有关,所以我更喜欢发布它。)

4

1 回答 1

2

从 System.Tether.AppProfile(XE8 版本)查看相关代码,似乎是一个 bug。请参阅下面的内联评论。请向https://quality.embarcadero.com报告

function TTetheringAppProfile.SendStream(const AProfile: TTetheringProfileInfo; const Description: string;
  const AStream: TStream): Boolean;
var
  LProfileInfo: TTetheringProfileInfo;
  LConnection: TTetheringConnection;
  LCommand: TTetheringCommand;
begin
  if not FindProfile(AProfile.ProfileIdentifier, LProfileInfo) then
    raise ETetheringException.CreateFmt(SNoProfile, [AProfile.ProfileIdentifier]);
  CheckProfileIsConnected(AProfile);
  LConnection := GetConnectionTo(AProfile);
  TMonitor.Enter(LConnection);
  try
    LCommand := LConnection.Protocol.SendCommandWithResponse(SendStreamCommand, Version, Description);
    if LCommand.Command = SendStreamOkResponse then
    begin
      Result := LConnection.Protocol.TransferStream(AStream);
      if Result then
      begin    <-- Result here is guaranteed to be True
        LCommand := LConnection.Protocol.ReceiveCommand;
        if LCommand.Command = SendStreamContentOKResponse then
          Result := True;  <-- Sets Result to True if succeeds, 
              <-- but nothing to set Result to False if call failed.
      end;
    end
    else
      Result := False;
  finally
    TMonitor.Exit(LConnection);
  end;
end;
于 2015-04-19T10:54:44.847 回答