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:
Date: 5 years 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);
    }
}


For more information send a message to info at phpclasses dot org.