套接字错误#113无法在Android上托管主机 [英] Socket Error #113 No route to host on Android

查看:141
本文介绍了套接字错误#113无法在Android上托管主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Delphi XE6 FireMonkey应用程序中,当我按下按钮时,在Android上出现以下错误:

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

套接字错误#113没有通往主机的路由

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;

TIdHTTP组件是否需要另一个组件才能工作?

Does the TIdHTTP component require another component to work?

推荐答案

应用程序无法与x.x.x.x

要验证错误,请尝试使用Web浏览器或端口80上的Telnet从同一台计算机连接到主机x.x.x.x.如果无法正常连接Web,则Indy TIdHTTP也将无法连接. (Ping不适用于http)

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)

注意:在Android上,使用内置的默认浏览器进行测试.另外,请检查应用程序权限是否包括INTERNET权限.

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

这篇关于套接字错误#113无法在Android上托管主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆