Net_Server
[ class tree: Net_Server ] [ index: Net_Server ] [ all elements ]

Class: Net_Server

Source Location: /Net_Server-1.0.3/Net/Server.php

Class Overview


PHP socket server base class


Author(s):

Version:

  • 0.11 alpha

Methods


Inherited Variables

Inherited Methods


Class Details

[line 86]
PHP socket server base class

This class must only be used to create a new server using the static method 'create()'.

To handle the events that happen while the server is running you have to create a new class that handles all events.

  1.  require_once 'myHandler.php';
  2.  require_once 'Net/Server.php';
  3.  
  4.  $server &Net_Server::create('fork''localhost'9090);
  5.  
  6.  $handler &new myHandler;
  7.  
  8.  $server->setCallbackObject($handler);
  9.  
  10.  $server->start();

See Server/Handler.php for a baseclass that you can use to implement new handlers.



[ Top ]


Method Detail

create   [line 106]

object Net_Server_Driver &create( string $type, string $host, integer $port)

Create a new server

Currently two types of servers are supported:

  • 'sequential', creates a server where one process handles all request from all clients sequentially
  • 'fork', creates a server where a new process is forked for each client that connects to the server. This only works on *NIX
This method will either return a server object or a PEAR error if the server type does not exist.

  • Return: server object of the desired type
  • Throws: object PEAR_Error
  • Access: public

Parameters:

string   $type   —  type of the server
string   $host   —  hostname
integer   $port   —  port

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:10 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.