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] gurugeek
Dear Maintainer, Your package net_socket has currently 1 open bug. We urge you to take the necessary steps to solve the reported issues at your soonest convenience. If the bug issue hasn’t been addressed yet you are kindly asked to take the necessary steps to ensure a prompt resolution of the problem. If you already addressed the reported problem feel free to change the bug status as soon as possible. Regards David Costa PEAR Quality Assurance pear-qa@lists.php.net
 [2005-02-02 21:43 UTC] chagenbu
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.