PHP Classes

File: tests/manually/TestServerSocketCallback.php

Recommend this page to a friend!
  Classes of Maik Greubel   PHP Generics   tests/manually/TestServerSocketCallback.php   Download  
File: tests/manually/TestServerSocketCallback.php
Role: Class source
Content type: text/plain
Description: Callback for manually testing ServerSocket
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Update of tests/manually/TestServerSocketCallback.php
Date: 2 months ago
Size: 551 bytes
 

Contents

Class file image Download
<?php

namespace tests\manually;

use
Generics\Socket\ServiceCallback;
use
Generics\Socket\Socket;

class
TestServerSocketCallback extends ServiceCallback
{

    public function
callback(Socket $client)
    {
       
// printf ( "Incoming connection from %s (remote port = %d)\n",
        // $client->getEndpoint ()->getAddress (), $client->getEndpoint ()->getPort () );
       
$in = null;
        if ((
$buf = $client->read(1024)) !== null) {
           
$in = $buf;
        }
       
// Just return to sender
       
$client->write($in);
    }
}