|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-11-19 19:43 UTC] danny at cvs dot php dot net
[2002-06-16 09:00 UTC] sander@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 14:00:01 2025 UTC |
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.