php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8775 pfsockopen - socket_get_status has EOF set.. feof() returns false
Submitted: 2001-01-18 01:00 UTC Modified: 2001-12-13 06:23 UTC
From: seymour at foxvalley dot net Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
20 + 28 = ?
Subscribe to this entry?

 
 [2001-01-18 01:00 UTC] seymour at foxvalley dot net
i have found that socket_get_status will say that an EOF has occurred but feof() says otherwise (and the socket isn't disconnected). feof() seems to be working fine.
im using pfsockopen() to create the socket.

also, im seeing 0 bytes unread until i attempt reading once, then the correct number of bytes remaining are listed. 

this may be unrelated but once i have read all of the bytes remaining, i get a EOF (detected by feof() and the connection is toast after that point). it could be a bug somewhere in my scripts logic.. but who knows.


System Linux 2.0.36 #4 Thu Aug 19 23:54:41 CDT 1999 i586 unknown 
Build Date Jan 15 2001 
Configure Command './configure' '--with-mysql' '--with-apache=../apache_1.3.4' '--enable-track-vars' 
Server API Apache 
Virtual Directory Support disabled 
Configuration File (php.ini) Path /usr/local/lib 
ZEND_DEBUG disabled 
Thread Safety disabled 


code snippit:

 $stat = socket_get_status($socketptr);
 if ($stat["eof"] == 1) {
                if (!(feof($socketptr))) {
                        print "socket_get_status lied?";
                        return true;
                }
                else {
                        fclose($socketptr);
                        print "REMOTE CLOSED CONNECTION<br>";
                        exit;  
                }
        }


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-20 12:09 UTC] seymour at foxvalley dot net
After further working with this, I have found that even if I keep all of my code within one script and never fclose() I'm still getting disconnected after all the data is read. I'm pretty sure that this is not related to my code. I verified via telnet that the server I'm connecting to does not close the connection.


 [2001-11-21 12:12 UTC] mfischer@php.net
Can you try with latest RC and see if it works

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.

 [2001-12-13 06:23 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC