I'm having this incredibly crazy error! I drop idhttpserver,webbrowser on a new mobile android app.
I want the server to provide content to the browser. It works great on windows but fails on my android device. I tested a tcpserver and tcpclient. I can get the client to connect, but when I start writeln and readln I get segmentation fault.
Even if I run with debugging off the application still crashes... here is the code snippet.
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;