Bug #2760 Updated: Failure to read from Windows sockets

From: Date: Sun, 16 Jun 2002 13:00:41 +0000
Subject: Bug #2760 Updated: Failure to read from Windows sockets
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-10715@lists.php.net to get a copy of this message
ID: 2760 Updated by: sander@php.net Reported By: pjones@ssc.nmfs.gov -Status: Open +Status: Bogus Bug Type: Misbehaving function Operating System: Mandrake Linux 6.1 PHP Version: 3.0.12 New Comment: Thank you for taking the time to report a problem with PHP. Unfortunately, PHP 3 is no longer supported. Please download the latest version of PHP 4 from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. Previous Comments: ------------------------------------------------------------------------ [1999-11-19 19:43:29] danny@cvs.php.net I had a similar problem where the NT App did not terminate the reply with a newline but with a ">" prompt character. Replacing the fgets() with an fgtec() loop that stopped on detecting the terminating ">" promt solved the mystery. must a lot slower, but it worked. I use PHP 3.013-dev though (compiled from CVS about a month ago). Danny --- ------------------------------------------------------------------------ [1999-11-18 21:46:00] pjones@ssc.nmfs.gov We have php 3.0.12/apache running on a Mandrake Linux 6.1 server, attempting to communicate with a socket on a Windows NT 4.0 sp5 machine. Write operations to the socket are successful, but reading back from the socket always blocks until timeout. Here's what's supposed to happen: 1. PHP opens a socket to the Windows machine 2. PHP writes a string (a processing instruction to the app on Windows) 3. The app on Windows writes a reply back to PHP 4. PHP reads the reply into a variable, etc etc Steps 1-3 work correctly. However, php always fails to read back the reply from the Windows application using any number of approaches, such as: function doTest(&$command) { $reply; $fp = fsockopen("marlin.ssc.nmfs.gov", 6692, &$errno, &$errstr, 30); if(!$fp) { return "Error opening socket."; } else { fputs($fp,$command); while ($buffer = fgets($fp, 128)) { $reply .= $buffer; } fclose($fp); } return $reply; } or replace the fgets with calls to fgetc, or any other piece of file-reading code. Note the similarity to jisun66@hotmail.com's comment on the fgets manual page online, and the similarity to bug #2493. FWIW, reading from the windows socket using a java program works without a hitch, so it does appear to be a php-specific problem. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=2760&edit=1

« previous php.bugs (#10715) next »