socket_write return wrong data length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm writting a little telnet client, but I've a problem with the socket_write function

        public function send($data){
                $datalen = strlen($data);
                $datawritten = 0;
                do {
                        $datawritten = socket_write($this->_tnsocket, $data, $datalen);
                        if( $datawritten === FALSE) {
                                echo __METHOD__." : ".socket_strerror(socket_last_error())."\n";
                                return (FALSE);
                        }
                        echo "Bytes written : ".$datawritten."\n";
                        $data = substr($data, $datawritten);
                        $datalen = strlen($data);
                } while($datawritten < $datalen);

                return (TRUE);
        }


When I use this function for writting a sample message of 4526 Bytes it returns :
	Bytes written : 4526
But it really wrotes only 1460 Bytes (verified with Wireshark).

So my question is why socket_write returns me a wrong data length ?

Thanks


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux