#16114 [NoF->Csd]: fputs doesn't send all data(WORKS!)
| From: | manu at chasqui dot uclv dot edu dot cu | Date: | Mon, 02 Dec 2002 01:47:21 +0000 |
| Subject: | #16114 [NoF->Csd]: fputs doesn't send all data(WORKS!) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-26338@lists.php.net to get a copy of this message | ||
ID: 16114
User updated by: manu@chasqui.uclv.edu.cu
-Summary: fputs doesn't send all data(better now!)
Reported By: manu@chasqui.uclv.edu.cu
-Status: No Feedback
+Status: Closed
Bug Type: Sockets related
Operating System: Windows 2000 AS
PHP Version: 4.1.1-4.3/CVS
New Comment:
Congratulations!
I have done the same tests, and I have sent up to 40MB.
The snapshot I used for testing was:
php4-win32-STABLE-200212011730.zip
Manu.
Previous Comments:
------------------------------------------------------------------------
[2002-10-29 01:00:02] php-bugs@lists.php.net
No feedback was provided for this bug for over 2 weeks, 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".
------------------------------------------------------------------------
[2002-10-13 18:54:27] wez@php.net
Please try the next snapshot.
------------------------------------------------------------------------
[2002-10-13 18:40:35] wez@php.net
Scratch that; I just discovered something in the MSDN docs.
------------------------------------------------------------------------
[2002-10-13 18:34:13] wez@php.net
I've just committed a little patch that might fix this problem; PHP was
calling shutdown(2) prior to closing the socket, and this may have been
causing the data-loss.
If you can compile PHP yourself, comment out the shutdown line in
main/network.c.
Otherwise, you need to wait for the next snapshot to be built (could be
3 hours away).
Please let me know how you get on.
------------------------------------------------------------------------
[2002-10-13 15:08:38] manu@chasqui.uclv.edu.cu
The lastest snapshot(Oct 13, 2002; php4-win32-latest.zip) works almost
fine.
This code:
$socket = @fsockopen( 'localhost', 80, $err1, $err2 );
if (!$socket) die('socket not open');
$result = fputs( $socket, $request ); #$request holds a well formed
MIME request for posting a file.
fflush( $socket );
//echo "<pre>>>\r\n".str_replace('</pre>',
'</pre>',
$request)."<<\r\n</pre>";
fclose( $socket );
This works if the file being posted is small(can't say how much). The
point is that if I uncomment the echo line before fclose(), it sends
all the data(up to 10.5M=11,076,608 bytes I sent), but without the echo
line, it seems that fclose() executes in such a way that chops the
socket's output stream and the Web Server does not executes the
receive.php script.
The echo line may be replace by sleep(8) and still working.
Summary:
Give it time before fclose() a works; otherwise, unstable.
Manu.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/16114
--
Edit this bug report at http://bugs.php.net/?id=16114&edit=1