background image

    

function

 closeHost() 

    

        

if

 (

$this

->resHandler) 

        

            

fclose(

$this

->resHandler); 

        

        

return

 true; 

    

}

    

//发送指令 

    

function

 sendCommand(

$strCommand

    

        

if

 (

$this

->bolDebug) 

        

            

if

 (!preg_match("/PASS/", 

$strCommand

)) 

            

                echo

 "Send Command: ".

$strCommand

."\r\n"; 

            

            

else

 

            

                echo

 "Send Command: PASS ******\r\n"; 

            

}

        

        

if

 (!

$this

->getIsConnect()) 

        

            

return

 false; 

        

        

if

 (trim(

$strCommand

)=='') 

        

            

$this

->setMessage('Request command is empty', 1004); 

            

return

 false; 

        

        

$this

->strRequest = 

$strCommand

."\r\n"; 

        

$this

->arrRequest[] = 

$strCommand

        fputs

(

$this

->resHandler, 

$this

->strRequest); 

        

return

 true; 

    

}

    

//提取响应信息第一行 

    

function

 getLineResponse() 

    

        

if

 (!

$this

->getIsConnect()) 

        

            

return

 false; 

        

        

$this

->strResponse = 

fgets

(

$this

->resHandler, 

$this

->intBuffSize);