Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Bug #980 Block write works better on Windows XP
Submitted: 2004-03-09 13:18 UTC
From: ash at bigfoot dot de Assigned: chagenbu
Status: Closed Package: Net_Socket
PHP Version: 5.0.0b4 (beta4) OS: Windows NT HAL 5.1 build 2600
Roadmaps: (Not assigned)    
Subscription  


 [2004-03-09 13:18 UTC] ash at bigfoot dot de
Description: ------------ I tried to send big emails with PEAR Mail, but there always occured this, regardless of isBlocking() = TRUE or FALSE: PHP Notice: fputs(): send of 8192 bytes failed with errno=0 Resource temporarily unavailable. This seemed to be WinSock error 10035: WSAEWOULDBLOCK, so I changed the write method to send blocks of data. The PHP Notice now comes for every call of fwrite, but the mail can be send. An @ before fwrite even let the PHP Notices disappear ;-) Keep up the good work, René Reproduce code: --------------- function write($data, $blocksize = 8192) { if (is_resource($this->fp)) { $pos = 0; $size = strlen($data); while($pos < $size) { $written = fwrite($this->fp, substr($data, $pos, $blocksize), $blocksize); if(FALSE === $written) return FALSE; $pos += $written; } return $pos; } return $this->raiseError("not connected"); }

Comments

 [2004-04-04 03:33 UTC] chris at lodesys dot com
Ran into the same problem with 5.0.0RC1. Tried René's patch, which helped, but still having problems with the large $blocksize. Changed the blocksize & modified the fwrite call. Now able to send large PDF files as attachments without errors. Running Apache 1.3.28 & PHP/5.0.0RC1 under Windows 2000 SP3. My version of the patch is as follows... function write($data, $blocksize = 1280) { if (is_resource($this->fp)) { $pos = 0; $size = strlen($data); while($pos < $size) { @$written = fwrite($this->fp, substr($data, $pos, $blocksize)); if(FALSE === $written) return FALSE; $pos += $written; } return $pos; } return $this->raiseError("not connected"); } Not pretty, but it works.
 [2004-07-11 22:40 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-02-02 21:43 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!