Example #1
0
 public function read($len = 2048)
 {
     return parent::read($len);
 }
Example #2
0
 public function ready3()
 {
     while (true) {
         $msg = socket_accept($this->sock);
         // 接受一个SOCKET
         if (!$msg) {
             echo "socket_accept() failed:" . socket_strerror($msg) . "\n";
             break;
         }
         $dd = parent::read();
         socket_write($msg, $dd, strlen($dd));
         $dd = trim(socket_read($msg, 1024));
         ob_start();
         print "<pre>\r\n";
         print_r($dd);
         print "</pre>\r\n";
         $fp = fopen('zzzzzzzzzzzzzzzzzzzzzzzz.txt', 'wb');
         fwrite($fp, ob_get_contents());
         fclose($fp);
         ob_end_clean();
         $dd = unserialize($dd);
         $result = Watt_Sync_MessageListManage::createAllMsgList($dd, 'outside');
         if ($result == '1') {
             $writer = '1';
         } else {
             $writer = '0';
         }
         socket_write($msg, $writer, strlen($writer));
         socket_close($msg);
         $command = strtoupper("quit");
         if ($command == "QUIT") {
             break;
         }
     }
     parent::close();
 }