ID:               16114
 User updated by:  [EMAIL PROTECTED]
-Summary:          fputs doesn't send all data
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           Open
 Bug Type:         Sockets related
 Operating System: Windows 2000 AS
 PHP Version:      4.1.1
 New Comment:

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>', '&lt;/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.


Previous Comments:
------------------------------------------------------------------------

[2002-09-26 10:38:03] [EMAIL PROTECTED]

What's the status on this?
Are you sure this is an issue with fputs and not instead
an issue with file upload to a PHP script?
What are you connecting to?
If you are testing again, please try the latest snapshot;
more changes have been made.
http://snaps.php.net/win32/

------------------------------------------------------------------------

[2002-07-21 12:42:05] [EMAIL PROTECTED]

I downloaded the file php4-win32-200207182200.zip and made a test
uploading a 3.2MB file. It didn't work. With smallers files(a test with
a 13b one) works. I'll do a test trying to establish the failure
boundaries.

Manu.

------------------------------------------------------------------------

[2002-07-18 21:49:39] [EMAIL PROTECTED]

I will do. In this moment I've been facing troubles with my Internet
connection, and I cannot download the snapshots.

Manu.

------------------------------------------------------------------------

[2002-07-10 12:29:00] [EMAIL PROTECTED]

Could you try this on 4.2.1, and the latest snapshot on
http://snaps.php.net/win32/ ?

The internal streams subsystem has been implemented in the snapshots,
which is a complete rewrite.

Thanks,

-Jason


------------------------------------------------------------------------

[2002-03-25 16:12:18] [EMAIL PROTECTED]

I did also a test(without chunking the data), I could send 48653 bytes,
but couldn't 49229 bytes. 
With the chunking feature it must be some bug in my code, cause didn't
work with 48653 bytes.

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

Reply via email to