Notice: fwrite(): send of 6 bytes failed with errno=32 Broken pipe in

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Notice: fwrite(): send of 6 bytes failed with errno=32 Broken pipe in

    Hallo,

    ich habe eine Klasse geschrieben mit der ich mir die eMail via POP3 aus dem Postfach auslesen. Und ich bekomm oft (aber nicht immer) diese Fehlermeldung im Skript

    Notice: fwrite(): send of 15 bytes failed with errno=32 Broken pipe in /srv/www/vhosts/domain.com/httpdocs/includes/email.class.php on line 192

    Notice: fwrite(): send of 6 bytes failed with errno=32 Broken pipe in /srv/www/vhosts/domain.com/httpdocs/includes/email.class.php on line 192
    Keine eMails vorhanden.

    Notice: fwrite(): send of 6 bytes failed with errno=32 Broken pipe in /srv/www/vhosts/domain.com/httpdocs/includes/email.class.php on line 192
    Hier ist der Auszug aus der Klasse wo der Fehler auftritt!
    PHP-Code:
            protected function email_Put($cmd)
            {
                
    fwrite($this->email_connection$cmd."\r\n");
            } 
    Kann mir jemand erklären was da schief läuft? Denn eine eMail kann ich da leider nicht auslesen.

    Danke!

    Nochmal ein Teil der ganzen Klassen
    PHP-Code:
    <?php
        
    class email extends core
        
    {
            protected   
    $error_message      '';
            protected   
    $error_count        0;

            protected   
    $email_connection   NULL;
            public      
    $email_timeout      10;

            
    /**
             *  Konstruktor
             */
            
    function __construct()
            {
                
    parent::__construct();
            }

            
    /**
             *  Destruktor
             */
            
    function __destruct()
            {
                if (
    $this->email_connection)
                {
                    
    $this->email_Put('QUIT');
                    
    fclose($this->email_connection);
                }
            }

            
    ////////////////////////////////////////////////////////////////////////
            //  ERROR-HANDLING
            ////////////////////////////////////////////////////////////////////////

            
    public function email_addError($strMessage)
            {
                
    $this->error_count++;
                
    $this->error_message.= '<li>'.htmlentities($strMessage).'</li>';
                return 
    false;
            }

            public function 
    email_isError()
            {
                if (
    $this->error_count)
                    return 
    true;
                else
                    return 
    false;
            }

            public function 
    email_showError()
            {
                if (!
    $this->error_count$this->error_message '<li>Keine Fehler gefunden</li>';
                return 
    '<ul>'.$this->error_message.'</ul>';
            }

            
    ////////////////////////////////////////////////////////////////////////
            //  EMAIL
            ////////////////////////////////////////////////////////////////////////

            /**
             *  Verbindung zum POP3-Postfach herstellen
             */
            
    public function email_connect($host,$port,$username,$password)
            {
                
    // Verbindung herstellen
                
    $this->email_connection fsockopen($host,$port,$errno,$errstr,$this->email_timeout);
                if (
    $errno)
                    return 
    $this->email_addError('('.$errno.') '.$errstr);

                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer))
                    return 
    $this->email_addError('Verbindung konnte nicht hergestellt werden ('.$answer.')');

                
    // Einloggen
                
    $this->email_Put('USER '.$username);
                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer) )
                {
                    
    $this->email_Put('QUIT');
                    return 
    $this->email_addError('Benutzer konnte nicht eingeloggt werden ('.$answer.')');
                }
                
    $this->email_Put('PASS '.$password);
                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer))
                {
                    
    $this->email_Put('QUIT');
                    
    $this->email_connection NULL;
                    return 
    $this->email_addError('Passwort falsch ('.$answer.')');
                }
                return 
    true;
            }

            
    /**
             *  Statistiken des Postfachs
             */
            
    public function email_stats()
            {
                
    $retval null;
                
    $this->email_Put('STAT');
                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer))
                {
                    
    $this->email_Put('QUIT');
                    return 
    $this->email_addError('eMail-Statistiken konnten nicht abgefragt werden ('.$answer.')');
                }
                list(,
    $retval['number'],$retval['size']) = split(' ',$answer);
                return 
    $retval;
            }

            
    /**
             *  Anzahl der Nachrichten im Postfach
             */
            
    public function email_newMessages()
            {
                
    $retval $this->email_stats();
                return 
    $retval['number'];
            }

            
    /**
             *  Liste aller Nachrichten im Postfach
             */
            
    public function email_listing()
            {
                
    $this->email_Put('LIST');
                
    $answer $this->email_Get();
                
    $retval = array();
                if (!
    $this->email_Check($answer))
                {
                    
    $this->email_Put('QUIT');
                    return 
    $this->email_addError('eMail-Liste konnte nicht abgefragt werden ('.$answer.')');
                }
                
    $answer split("\n",$this->email_Get(true));
                for (
    $x=0$x<sizeof($answer)-1$x++)
                {
                    
    $tmp split(' ',$answer[$x]);
                    
    $retval[$tmp[0]] = $tmp[1];
                }
                if (isset(
    $retval[''])) unset($retval['']);
                return 
    $retval;
            }

            
    /**
             *  Holt eine Nachricht vom Postfach
             */
            
    public function email_getMessage($id)
            {
                
    $this->email_Put('RETR '.$id);
                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer))
                {
                    
    $this->email_Put('QUIT');
                    return 
    $this->email_addError('eMail-Nachricht konnte nicht abgefragt werden ('.$answer.')');
                }
                
    $answer $this->email_Get(true);
                return 
    $answer;
            }

            
    /**
             *  Markiert eine eMail zum Löschen
             */
            
    public function email_delMessage($id)
            {
                
    $this->email_Put('DELE '.$id);
                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer))
                {
                    
    $this->email_Put('QUIT');
                    return 
    $this->email_addError('eMail-Nachricht konnte
     nicht fürs Löschen markiert werden ('
    .$answer.')');
                }
                return 
    1;
            }

            
    /**
             *  Hebt alle Markierungen für das Löschen der eMails auf
             */
            
    public function email_resetMessages()
            {
                
    $this->email_Put('RSET');
                
    $answer $this->email_Get();
                if (!
    $this->email_Check($answer))
                {
                    
    $this->email_Put('QUIT');
                    return 
    $this->email_addError('Das Löschen der eMail-
    Nachrichten konnte nicht verhindert werden ('
    .$answer.')');
                }
                return 
    1;
            }

            
    /**
             *  Setz ein Befehl
             */
            
    protected function email_Put($cmd)
            {
                
    fwrite($this->email_connection$cmd."\r\n");
            }

            
    /**
             *  Holt die Antwort
             */
            
    protected function email_Get($stream false)
            {
                
    $retval null;
                if (!
    $stream)
                    
    $retval fgets($this->email_connection,1024);
                else
                    while (!
    feof($this->email_connection))
                    {
                        
    $tmp fgets($this->email_connection,1024);
                        if (
    chop($tmp) == '.') break;
                        
    $retval.= $tmp;
                    }
                return 
    $retval;
            }

            
    /**
             *  Prüft die Antwort
             */
            
    protected function email_Check($answer)
            {
                
    $stat substr($answer,0,strpos($answer,' '));
                if (
    $stat == '-ERR')
                    return 
    false;
                else
                    return 
    true;
            }

        }

    ?>
    Zuletzt geändert von ; 06.09.2008, 14:47.

  • #2
    keiner eine Idee?

    Kommentar


    • #3
      Informiere dich über fwrite und broken pipes. Ich vermute mal dein Mailserver hat einen Timeout und beendet die Verbindung. (was du nicht abfängst)

      Kommentar


      • #4
        keiner eine Idee?
        OffTopic:
        Hammers eilig?

        Kommentar


        • #5
          Original geschrieben von frankburian
          keiner eine Idee?
          Klar!
          Verwende http://de2.php.net/manual/de/book.imap.php , bis deine Klasse fertig ist...
          Wir werden alle sterben

          Kommentar

          Lädt...
          X