Lines Matching refs:socket
262 $socket = null;
265 $socket = self::$connections[$connectionId];
267 if (is_null($socket) || feof($socket)) {
270 $socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout);
271 if (!$socket){
279 if($this->_ssltunnel($socket, $request_url)){
288 fclose($socket);
294 self::$connections[$connectionId] = $socket;
311 stream_set_blocking($socket, 0);
321 $this->_sendData($socket, $request, 'request');
326 $r_line = $this->_readLine($socket, 'headers');
376 fclose($socket);
407 … while (preg_match('/^[a-zA-Z0-9]?$/',$byte=$this->_readData($socket,1,'chunk'))){
413 $this->_readLine($socket, 'chunk'); // readtrailing \n
425 $r_body .= $this->_readData($socket, $chunk_size, 'chunk');
426 $this->_readData($socket, 2, 'chunk'); // read trailing \r\n
443 … $r_body = $this->_readData($socket, $length, 'response (content-length limited)', true);
445 …$r_body = $this->_readData($socket, $this->max_bodysize, 'response (content-length limited)', true…
450 while (!feof($socket)) {
451 $r_body .= $this->_readData($socket, 4096, 'response (unlimited)', true);
471 fclose($socket);
478 fclose($socket);
510 function _ssltunnel(&$socket, &$requesturl){ argument
525 $this->_sendData($socket, $request, 'SSL Tunnel CONNECT');
530 $r_line = $this->_readLine($socket, 'headers');
537 stream_context_set_option($socket, 'ssl', 'peer_name', $requestinfo['host']);
548 if (@stream_socket_enable_crypto($socket, true, $cryptoMethod)) {
563 * @param resource $socket An open socket handle
570 function _sendData($socket, $data, $message) { argument
579 if(feof($socket))
584 $sel_w = array($socket);
593 $nbytes = fwrite($socket, substr($data,$written,4096));
606 * @param resource $socket An open socket handle in non-blocking mode
615 function _readData($socket, $nbytes, $message, $ignore_eof = false) { argument
626 if(feof($socket)) {
634 $sel_r = array($socket);
643 $bytes = fread($socket, $to_read);
658 * @param resource $socket An open socket handle in non-blocking mode
665 function _readLine($socket, $message) { argument
673 if(feof($socket))
677 $sel_r = array($socket);
686 $r_data = fgets($socket, 1024);