ID:               32075
 User updated by:  mike_harris02135 at yahoo dot com
 Reported By:      mike_harris02135 at yahoo dot com
 Status:           Open
 Bug Type:         Sockets related
 Operating System: linux
 PHP Version:      4.3.10
 New Comment:

incidently, I also tried using the fsockopen method and fread and
fwrite, and that did not detect an error either...


Previous Comments:
------------------------------------------------------------------------

[2005-02-23 08:35:51] mike_harris02135 at yahoo dot com

Description:
------------
Ive been on the forums and noone seems to be able to help with this.

Im writing a jabber client with php.  I connect to the server, send a
message, sleep for 20 seconds (kill the server during this time), then
send another message, and the code used to send the message does not
report any error.

Reproduce code:
---------------
function WriteToSocket($data)
        {
                echo "\nIn WriteToSocket: $data\n";
                echo "-------------Socket = " . $this->socket . "\n";

                if(socket_last_error($this->socket))
                {
                        print "Detected error\n";
                        echo socket_strerror(socket_clear_error($this->socket));
                }

                
                return socket_write($this->socket, $data, strlen($data));
                
        }

Expected result:
----------------
i expect socket_last_error to report that the socket was closed
unexpectedly.  Incidently, when I create the socket i always get an
error with unknown error code, but the server receives the message just
fine.  Or the socket_write method would return 0, or the socket
reference would be null.

Actual result:
--------------
The code does not indicate any error, and reports that n bytes were
written.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32075&edit=1

Reply via email to