Ignore:
Timestamp:
01/18/08 15:17:58 (16 years ago)
Author:
niltonneto
Message:

Commit da nova versão do módulo, usando agente em C.
Vide Página do módulo do Trac:
http://www.expressolivre.org/dev/wiki/messenger

A versão anterior encontra-se na subpasta bkp (32/64).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/inc/Socket.abstract.php

    r63 r151  
    2020        protected final function open( $pSocket = false, $pTimeOut = 1, $pBlockingMode = 0 ) 
    2121        { 
    22       if ( !$pSocket ) 
    23          return false; 
     22                if ( !$pSocket ) 
     23                        return false; 
    2424 
    25       if ( $socket = @stream_socket_client($pSocket, $errno, $errstr) ) 
    26       { 
    27          stream_set_blocking($socket, $pBlockingMode); 
    28          stream_set_timeout($socket, $pTimeOut); 
    29       } 
    30       return $socket; 
     25                if ( $socket = @stream_socket_client($pSocket, $errno, $errstr) ) 
     26                { 
     27                        #stream_set_blocking($socket, $pBlockingMode); 
     28                        #stream_set_timeout($socket, $pTimeOut); 
     29                        stream_set_blocking($socket, 1); 
     30                        stream_set_timeout($socket, 1); 
     31                } 
     32                return $socket; 
    3133        } 
    3234 
    33    protected final function blocking($pSocket = false, $pBlockingMode = 1) 
    34    { 
    35       if ( !$pSocket || !is_resource($pSocket) ) 
    36          return false; 
     35        protected final function blocking($pSocket = false, $pBlockingMode = 1) 
     36        { 
     37                if ( !$pSocket || !is_resource($pSocket) ) 
     38                        return false; 
    3739 
    38       stream_set_blocking($pSocket, $pBlockingMode); 
    39    } 
     40                stream_set_blocking($pSocket, $pBlockingMode); 
     41        } 
    4042 
    4143 
    4244        protected function read( $pSocket = false, $pLength = 4096 ) 
    4345        { 
    44       ini_set( 'track_errors', '1' ); 
    45       $php_errormsg = ''; 
     46                ini_set( 'track_errors', '1' ); 
     47                $php_errormsg = ''; 
    4648 
    47       if ( !$pSocket || !is_resource($pSocket) ) 
    48          return false; 
     49                if ( !$pSocket || !is_resource($pSocket) ) 
     50                        return false; 
    4951 
    50       set_magic_quotes_runtime(0); 
    51       $return = @fread($pSocket, $pLength); 
    52       set_magic_quotes_runtime(get_magic_quotes_gpc()); 
     52                set_magic_quotes_runtime(0); 
     53                $return = @fread($pSocket, $pLength); 
     54                set_magic_quotes_runtime(get_magic_quotes_gpc()); 
    5355 
    5456 
    55       if ( $php_errormsg ) 
    56          return false; 
     57                if ( $php_errormsg ) 
     58                        return false; 
    5759 
    58       return $return; 
     60                return $return; 
    5961        } 
    6062 
    6163        protected function write( $pSocket = false, $pData = false ) 
    6264        { 
    63       ini_set( 'track_errors', '1' ); 
    64       $php_errormsg = ''; 
    65        
    66       if ( (!$pSocket || !is_resource($pSocket)) || !$pData ) 
    67          return false; 
     65                ini_set( 'track_errors', '1' ); 
     66                $php_errormsg = ''; 
    6867 
    69           $return = @fwrite($pSocket, $pData); 
    70        
    71       if ( $php_errormsg ) 
    72          return false; 
     68                if ( (!$pSocket || !is_resource($pSocket)) || !$pData ) 
     69                        return false; 
    7370 
    74       return $return; 
     71                $return = @fwrite($pSocket, $pData); 
     72 
     73                if ( $php_errormsg ) 
     74                        return false; 
     75 
     76                return $return; 
    7577        } 
    7678 
    7779        protected final function close( $pSocket = false ) 
    7880        { 
    79       if ( !$pSocket || !is_resource($pSocket) ) 
    80          return false; 
     81                if ( !$pSocket || !is_resource($pSocket) ) 
     82                        return false; 
    8183 
    8284                return fclose($pSocket); 
Note: See TracChangeset for help on using the changeset viewer.