php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46062 pfsockopen() not working properly
Submitted: 2008-09-12 06:26 UTC Modified: 2008-11-03 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: srtm dot india at gmail dot com Assigned:
Status: No Feedback Package: Sockets related
PHP Version: 5.2.6 OS: Winxpsp2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: srtm dot india at gmail dot com
New email:
PHP Version: OS:

 

 [2008-09-12 06:26 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-15 00:35 UTC] 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-15 05:07 UTC] srtm dot india at gmail dot com
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
 [2008-10-26 11:23 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-11-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC