Beispiel #1
0
 /**
  * 结果处理
  * @param $response
  * @return ByteBuffer|string
  */
 function getResult($response)
 {
     if ($response) {
         $result = Tool::parse($response);
     } else {
         $result = "";
     }
     $data = ByteBuffer::wrap($result);
     return $data;
 }
Beispiel #2
0
 public function onServerReceive($server, $fd, $from_id, $data)
 {
     $this->startApp();
     $requestData = Tool::getParseInfo($data);
     $resData = $this->prepareRequest($requestData);
     $content = "";
     if ($resData) {
         $res = $this->handleRequest($resData);
         $content = $res->content();
     }
     $this->send($server, $fd, $content, $requestData);
     $this->stopApp();
 }
Beispiel #3
0
 public function send($server, $fd, $data, $requestData)
 {
     $data = Tool::binFormat($data, $requestData['bufferRouteMatch'], $requestData['bufferCompressType']);
     $server->send($fd, $data);
     //        $server->stop();
 }