Socket Error #113 No route to host on Android

三世轮回 提交于 2019-12-13 15:17:35

问题


In a Delphi XE6 FireMonkey app, when I press the button, I get the following error on Android:

Socket Error #113 No route to host

procedure TForm1.Button1Click(Sender: TObject);
var
  Intent: JIntent;
  datosPost: TIdMultiPartFormDataStream;
  mRespuestaPost: String;
begin
  try
    datosPost := TIdMultiPartFormDataStream.Create;
    datosPost.AddFormField('usuario', txtUser.Text);
    datosPost.AddFormField('password', txtPass.Text);
    mRespuestaPost := DataModule2.IdHTTP.Post
      ('http://X.X.X.X/CGLB/ac.php', datosPost);
    ShowMessage(mRespuestaPost);
  finally
    datosPost.Free;
  end;
end;

Does the TIdHTTP component require another component to work?


回答1:


The application failed to connect with x.x.x.x

To verify the error, try connecting to the host x.x.x.x from the same computer, using a web browser, or Telnet on port 80. If a normal web browser can not connect, Indy TIdHTTP will not be able too. (Ping is not useful for http)

Note: on Android, use the built-in default browser to do the test. Also check that the app permissions include the permission INTERNET.



来源:https://stackoverflow.com/questions/25850314/socket-error-113-no-route-to-host-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!