0

この信じられないほどクレイジーなエラーが発生しています。新しいモバイル Android アプリに idhttpserver,webbrowser をドロップします。

サーバーがブラウザにコンテンツを提供するようにします。Windows では問題なく動作しますが、Android デバイスでは失敗します。tcpserver と tcpclient をテストしました。クライアントを接続させることはできますが、writeln と readln を開始すると、セグメンテーション エラーが発生します。

アプリケーションをデバッグして実行してもクラッシュします...コードスニペットは次のとおりです。

procedure TForm37.Button1Click(Sender: TObject);
begin
  IdHTTPServer1.Bindings.Add;
  try
    IdHTTPServer1.Active := true; 
    if IdHTTPServer1.Active then
      Button1.Text := 'Server Started';
  except on E: Exception do
    Button1.Text := 'Server Failed';
  end;
end;

procedure TForm37.Button2Click(Sender: TObject);
var
  astring : string;
begin
  try
    astring := IdHTTP1.Get('http://10.0.1.78:6000/');
    // or  astring := IdHTTP1.Get('http://127.0.0.1:6000/');
    ShowMessage(astring);
  except on E: Exception do
    Button2.Text := 'connection failed';
  end;
end;

procedure TForm37.IdHTTPServer1CommandGet(AContext: TIdContext;
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
  AResponseInfo.ContentText := 
    '<html><head><title>My First Response</title></head>' +
    '<body>Command: ' + ARequestInfo.Command +
    '<br />Host: ' + ARequestInfo.Host +
    '<br />URI: ' + ARequestInfo.URI +
    '<br />UserAgent: ' + ARequestInfo.UserAgent +
    '</body></html>';
end;
4

1 に答える 1