#46062 [Fbk->Opn]: pfsockopen function not working properly
| From: | srtm dot india at gmail dot com | Date: | Mon, 15 Sep 2008 05:07:59 +0000 |
| Subject: | #46062 [Fbk->Opn]: pfsockopen function not working properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-128972@lists.php.net to get a copy of this message | ||
ID: 46062
User updated by: srtm dot india at gmail dot com
Reported By: srtm dot india at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Performance problem
Operating System: Winxpsp2
PHP Version: 5.2.6
New Comment:
Hi
Thanks for ur reply
I could not check that directly, but i am checking in my application
server which is in c# .net, i am identifying the client by
RemoteEndPoint. But no new tcp connections are made from apache, i am
sure the persistent connection is global.
If it is for per process, there is actually no need for persistent
connection.
I checked this by creating custom library for php using winsock2
library. here also i am facing the same problem, the connection is
reused, but after sending 33 messages using send function in winsock2
library fails with no error messages, I am checking in the app server
side for any messages received and counting the number of messages
received from a particular client. Up to 33 messages, everything is
working fine, after that I am not getting error or success, the same
resource is returned
Previous Comments:
------------------------------------------------------------------------
[2008-09-15 00:35:30] johannes@php.net
Are you sure you're always hitting the same apache child? Persistent
connections are per apache process/thread not globally.
------------------------------------------------------------------------
[2008-09-12 06:26:12] srtm dot india at gmail dot com
Description:
------------
Hi
I am using Apache 2.2.8 under Winxpsp2
I tried to use the 'pfsockopen' function.
After making the connection, i used 'fwrite' library function to send
data to the server more than 50 times.
But what happen is after receiving 33 messages, the tcp server doesnot
receive any messages from the client connected.
ie the php funnction fwrite is not sending no more than 33 messages.
I don't know whether this is a limitation or a bug. all the remaining
messages are discarded. but the connection is not thrown away.
I have given here the code for php, I had tested with c#.net
application tcp server.
cheers
kumar
Reproduce code:
---------------
<?php
$server = "172.20.112.101";
$port = 2055;
$errormsg = '';
$errorno = 0;
$fp = pfsockopen($server, $port, $errorno, $errormsg, 300);
fwrite($fp, "Data from client");
?>
Expected result:
----------------
I should be able to receive all the messages regardless of how many
messages i send using the pfsockopen and fwrite funcions.
Actual result:
--------------
After sending 33 messages, no messages are sent
i am requesting the page 50 times from the browser, the same connection
is reused for sending messages.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46062&edit=1