Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Debug  >  SuperSocket  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: SuperSocket
Handle multiple TCP socket connections
Author: By
Last change:
Date: 2008-06-02 22:04
Size: 440 bytes
 

Contents

Class file image Download
<?php

/*

Simple "echo back" TCP server.

*/

include("supersocket.class.php");

##### FIRST WITH OUR CALLBACKS #####
function newdata($socket_id$channel_id$buffer, &$obj)
    {
        
$obj->write($socket_id$channel_id$buffer);
    };

$socket = new SuperSocket(array("*:10000")); // will listen on ALL IPs over port 10000
$socket->assign_callback("DATA_SOCKET_CHANNEL""newdata");
$socket->start();
$socket->loop();

?>