Advertisement
Guest User

Untitled

a guest
Jul 15th, 2010
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <?php
  2. class V3_NSModule extends V3_Module
  3. {
  4.     public function _init()
  5.     {
  6.         $this -> author  = 'xardas';
  7.         $this -> version = '0.0.1';
  8.         $this -> description = 'Playground for even newer stuff';
  9.         $this -> deps    = array( 'Arc4', 'CLI'); /* zależności */
  10.         $this -> compat  = array( '0.0.1', '0.1.0' );
  11.         $this -> events  = array();
  12.         return true;
  13.     }
  14.    
  15.     public function socket_accepted( V3_Event $e )
  16.     {
  17.         $strClient = $e -> socket -> host. ':'. $e -> socket -> port;
  18.         V3::log('Got client: '. $strClient.'. Gonna do something \'bout it, maybe! SOCKET ALERT!');
  19.     }
  20.  
  21.     public function socket_read( V3_Event $e )
  22.     {
  23.         $socket = $e -> socket;
  24.         $data = $socket -> read();
  25.         V3::log('Our lovely socket wrote: '. $data);
  26.         V3::log('So we are going to echo it back.');
  27.         $socket -> write($data);
  28.     }
  29.    
  30.     public function socket_closed( V3_Event $e )
  31.     {
  32.         V3::log('Client got disconnected, crap!');
  33.     }
  34.    
  35.     public function event_activate( V3_Event $e )
  36.     {
  37.         V3::log( 'Memory usage so far: '. (memory_get_usage(true)/1024).' KB');
  38.         $objSocket = $this -> socketBind( '0.0.0.0', 666, V3::SOCKET_TEXT_READ );
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement