Re: [PHP] sockets - fine tunning

2003-10-28 Thread Raditha Dissanayake
Hi,

I think curt is right about transfer encoding being a problem, however i 
feel it may not be 'the' problem. This timing issue looks like you are 
running into a 'blocking' kind of situation. Cosmin, Have you tried the 
'Connection: close' header?
Getting back to transfer encoding you might want to look at the RFC -  
http://www.w3.org/Protocols/rfc2616/rfc2616.html
where they explain how it's to be handled.

all the best



Curt Zirzow wrote:

* Thus wrote Cosmin ([EMAIL PROTECTED]):
 

On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote:
   

are you getting any 1xx status codes from the web server?
 

here are the full headers:

Transfer-Encoding: chunked
   

This is probably the problem. If you inspect your data, you'll
notice that it has extra characters in it right now.  You can change your
protocol version to HTTP/1.0 or send a header to tell the server
you don't want chuncked (don't know that off hand).
Curt
 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sockets - fine tunning

2003-10-27 Thread Curt Zirzow
* Thus wrote Cosmin ([EMAIL PROTECTED]):
 On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote:
  are you getting any 1xx status codes from the web server?
 
 here are the full headers:

 Transfer-Encoding: chunked

This is probably the problem. If you inspect your data, you'll
notice that it has extra characters in it right now.  You can change your
protocol version to HTTP/1.0 or send a header to tell the server
you don't want chuncked (don't know that off hand).


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sockets - fine tunning

2003-10-26 Thread Raditha Dissanayake
are you getting any 1xx status codes from the web server?

Cosmin wrote:

I'm trying to make an application using XML-RPC, and I have the
following problem: I use fsockopen() to simulate a POST to my local
web-server. All goes very well except it's very very slow. Here is my
code maybe someone could tell me what I'm doing wrong:
=
$url= parse_url($this-serverURL);
$requestString= POST .$url['path']. HTTP/1.1\r\nHost:
.$url['host'].\r\nContent-type:
application/x-www.form-urlencoded\r\nContent-length:
.strlen($this-requestData).\r\n\r\n.$this-requestData;;
$fp = fsockopen($url['host'], 80, $err_num, $err_msg, 5);
if ($fp)
{
//make the request to the xml-rpc server
fputs($fp, $requestString);
//gets the result
while (!feof($fp))
{
$response .= fgets($fp, 1024);
}
fclose($fp);
$this-rawResponse=$response;
$this-error=false;
}
else
{
$this-error=true;
$this-errorMessage=$err_msg;
}

This is the slowest part of my script(about 16 seconds). The server's
execution time is only 0.00064206123352051 seconds. I don't know why it
takes so much to write a string to the socket and then to read the
response. Here are the execution times:
Server StartServer Stop
1067090777.5339 1067090777.5346

Client StartClient Stop
1067090777.5303 1067090794.5286
If someone knows a way on how to speed this up please tell me how to do
it.
Thank you for your time

 



--
Raditha Dissanayake.

http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB  |  with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] sockets - fine tunning

2003-10-26 Thread Cosmin
On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote:
 are you getting any 1xx status codes from the web server?

here are the full headers:
HTTP/1.1 200 OK
Date: Mon, 27 Oct 2003 06:15:30 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.3
X-Powered-By: PHP/4.3.3
Transfer-Encoding: chunked
Content-Type: text/xml

 Cosmin wrote:
 
 I'm trying to make an application using XML-RPC, and I have the
 following problem: I use fsockopen() to simulate a POST to my local
 web-server. All goes very well except it's very very slow. Here is my
 code maybe someone could tell me what I'm doing wrong:
 =
 $url= parse_url($this-serverURL);
 $requestString= POST .$url['path']. HTTP/1.1\r\nHost:
 .$url['host'].\r\nContent-type:
 application/x-www.form-urlencoded\r\nContent-length:
 .strlen($this-requestData).\r\n\r\n.$this-requestData;;
  $fp = fsockopen($url['host'], 80, $err_num, $err_msg, 5);
  if ($fp)
  {
  //make the request to the xml-rpc server
  fputs($fp, $requestString);
  //gets the result
  while (!feof($fp))
  {
  $response .= fgets($fp, 1024);
  }
  fclose($fp);
  $this-rawResponse=$response;
  $this-error=false;
  }
  else
  {
  $this-error=true;
  $this-errorMessage=$err_msg;
  }
 
 This is the slowest part of my script(about 16 seconds). The server's
 execution time is only 0.00064206123352051 seconds. I don't know why it
 takes so much to write a string to the socket and then to read the
 response. Here are the execution times:
  Server StartServer Stop
  1067090777.5339 1067090777.5346
  
  Client StartClient Stop
  1067090777.5303 1067090794.5286
 
 If someone knows a way on how to speed this up please tell me how to do
 it.
 
 
 Thank you for your time
 
   
 
 
 
 -- 
 Raditha Dissanayake.
 
 http://www.radinks.com/sftp/  |  http://www.raditha/megaupload/
 Lean and mean Secure FTP applet with  |  Mega Upload - PHP file uploader
 Graphical User Inteface. Just 150 KB  |  with progress bar.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sockets - fine tunning

2003-10-25 Thread Curt Zirzow
* Thus wrote Cosmin ([EMAIL PROTECTED]):
 I'm trying to make an application using XML-RPC, and I have the
 following problem: I use fsockopen() to simulate a POST to my local
 web-server. All goes very well except it's very very slow. Here is my
 code maybe someone could tell me what I'm doing wrong:
 =
 $url= parse_url($this-serverURL);
 $requestString= POST .$url['path']. HTTP/1.1\r\nHost:
 .$url['host'].\r\nContent-type:
 application/x-www.form-urlencoded\r\nContent-length:
 .strlen($this-requestData).\r\n\r\n.$this-requestData;;

Have you tried to simulate this on a web browser?  

My guess is there might be some dns issue somewhere causing the
webserver to take a while before even processing the request.

Try and find out where the bottleneck is by echo'ing between steps
to see where the problem is, for example:

echo time(), \n;
   $fp = fsockopen($url['host'], 80, $err_num, $err_msg, 5);
echo time(), \n;


Curt
-- 
My PHP key is worn out

  PHP List stats since 1997: 
http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] sockets - fine tunning

2003-10-25 Thread Cosmin
On Sat, 2003-10-25 at 17:42, Curt Zirzow wrote:
 * Thus wrote Cosmin ([EMAIL PROTECTED]):
  I'm trying to make an application using XML-RPC, and I have the
  following problem: I use fsockopen() to simulate a POST to my local
  web-server. All goes very well except it's very very slow. Here is my
  code maybe someone could tell me what I'm doing wrong:
  =
  $url= parse_url($this-serverURL);
  $requestString= POST .$url['path']. HTTP/1.1\r\nHost:
  .$url['host'].\r\nContent-type:
  application/x-www.form-urlencoded\r\nContent-length:
  .strlen($this-requestData).\r\n\r\n.$this-requestData;;
 
 Have you tried to simulate this on a web browser?  
 
 My guess is there might be some dns issue somewhere causing the
 webserver to take a while before even processing the request.
 
 Try and find out where the bottleneck is by echo'ing between steps
 to see where the problem is, for example:
 
 echo time(), \n;
  $fp = fsockopen($url['host'], 80, $err_num, $err_msg, 5);
 echo time(), \n;
 
 
 Curt
 -- 
 My PHP key is worn out
 
   PHP List stats since 1997: 
 http://zirzow.dyndns.org/html/mlists/
Here are the times:
1:1067092779.6042
2:1067092795.7176
And here is the code:
echo '1:'.getmicrotime(),\n\n;
while($data=fread($fp, 32768))
{
$response.=$data;
}
echo '2:'.getmicrotime(),\n\n;

I don't know what else to do ... I've changed the buffer length but it's
still the same :((

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php