Forum > Networking and Web Programming
[SOLVED] HTTPMethod in Synapse is slow and freezes program operation momentarily
newman:
Hi,
I have installed Apache2 server on my computer (OS: Ubuntu 10.04), with PHP and MySqlite support.
I am using this function below to send HTTP post method to a PHP file (that resides in a site also in my computer), I am using synapse library.
--- Code: ---function PostInetCommand(cPostData:string):string;
var
HTTP: THTTPSend;
l: tstringlist;
cResponse:string;
b:boolean;
begin
HTTP := THTTPSend.Create;
l := TStringList.Create;
try
if not HTTP.HTTPMethod('POST',cPostData) then
begin
Result:= 'Error';
end
else
begin
l.loadfromstream(Http.Document);
Result:= l.Text;
end;
finally
HTTP.Free;
l.free;
end;
end;
--- End code ---
I find that the program operation freezes momentarily and the response from PHP file is very slow (at least 3 -4 seconds), whereas the same post operation done from a browser is instantaneous.
Please explain why this is happening ?? also how can I improve the performance.
PS: Sorry if I could not make myself clear as I am new to network programming.
thanks
nm
Leledumbo:
Mine here is fast, could you make sure that it's faster with php?
Silvio Clécio:
Hi newman,
Use thread, see demos with threads in:
http://code.google.com/p/lazsolutions/
Good luck. ;)
newman:
--- Quote from: Leledumbo on January 31, 2011, 01:43:38 pm ---Mine here is fast, could you make sure that it's faster with php?
--- End quote ---
I am using PHP..and its not fast...
Just for my information how fast should the response from the server be ?
--- Quote from: silvioprog on January 31, 2011, 01:54:47 pm ---Hi newman,
Use thread, see demos with threads in:
http://code.google.com/p/lazsolutions/
Good luck. ;)
--- End quote ---
thanks for the link, I downloaded the lazsolutions zip file, but threads are a bit steep for me..but I am working on it...
Silvio Clécio:
Hi newman,
But isn't hardly, it's very easy, please see this:
http://code.google.com/p/lazarus-br/source/browse/trunk/misc/BeginThread/MainFrm.pas
Navigation
[0] Message Index
[#] Next page