Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class V3_NSModule extends V3_Module
- {
- public function _init()
- {
- $this -> author = 'xardas';
- $this -> version = '0.0.1';
- $this -> description = 'Playground for even newer stuff';
- $this -> deps = array( 'Arc4', 'CLI'); /* zależności */
- $this -> compat = array( '0.0.1', '0.1.0' );
- $this -> events = array();
- return true;
- }
- public function socket_accepted( V3_Event $e )
- {
- $strClient = $e -> socket -> host. ':'. $e -> socket -> port;
- V3::log('Got client: '. $strClient.'. Gonna do something \'bout it, maybe! SOCKET ALERT!');
- }
- public function socket_read( V3_Event $e )
- {
- $socket = $e -> socket;
- $data = $socket -> read();
- V3::log('Our lovely socket wrote: '. $data);
- V3::log('So we are going to echo it back.');
- $socket -> write($data);
- }
- public function socket_closed( V3_Event $e )
- {
- V3::log('Client got disconnected, crap!');
- }
- public function event_activate( V3_Event $e )
- {
- V3::log( 'Memory usage so far: '. (memory_get_usage(true)/1024).' KB');
- $objSocket = $this -> socketBind( '0.0.0.0', 666, V3::SOCKET_TEXT_READ );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement