Re: sockets - fine tunning
| From: | Cosmin | Date: | Sat, 25 Oct 2003 14:43:58 +0000 |
| Subject: | Re: sockets - fine tunning | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167553@lists.php.net to get a copy of this message | ||
On Sat, 2003-10-25 at 17:42, Curt Zirzow wrote:
> * Thus wrote Cosmin (cosminb@as.ro):
> > 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 :((