File: tests/manually/ClientTestManually.php

Recommend this page to a friend!
  Classes of Maik Greubel  >  PHP Generics  >  tests/manually/ClientTestManually.php  >  Download  
File: tests/manually/ClientTestManually.php
Role: Unit test script
Content type: text/plain
Description: Unit test for manually testing ClientSocket
Class: PHP Generics
Framework for accessing streams, sockets and logs
Author: By
Last change: Remove unused imports warnings
Date: 3 years ago
Size: 668 bytes
 

Contents

Class file image Download
<?php
set_include_path
(get_include_path() . PATH_SEPARATOR . '../../');

require_once
'Generics/Socket/ClientSocket.php';
require_once
'Generics/Socket/Endpoint.php';
require_once
'Generics/Socket/SocketException.php';

use
Generics\Socket\ClientSocket;
use
Generics\Socket\Endpoint;

$clientEndpoint = new Endpoint('127.0.0.1', 8421);
$client = new ClientSocket($clientEndpoint);
$client->connect();

printf("Connected!\n");

$client->write("Hello from manually test client");

printf("Send message\n");

$response = null;

if ((
$buf = $client->read(1024)) !== null) {
   
$response = $buf;
}

$client->disconnect();

printf("Response from server: %s\n", $response);


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