1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| OPEN :
$this->_sock = fsockopen($this->_server, $this->_port, $errno, $errstr, 30);
//$this->_sock = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
WRITE :
//socket_write($this->_sock, $this->_writebuffer,strlen($this->_writebuffer));
fwrite($this->_sock, $this->_writebuffer,strlen($this->_writebuffer));
READ :
$buffer = "";
/*while ($data = socket_read ($this->_sock,1024*1024,PHP_BINARY_READ)) {
if ($this->db) debug ("data", $data);
$this->readyState = 3;
$buffer.= $data;
}*/
while (!feof($this->_sock)) {
$data = fread($this->_sock, 8192);
if ($this->db) debug ("data", $data);
$this->readyState = 3;
$buffer.= $data;
} |