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

Class: Net_Server_Driver_Sequential

Source Location: /Net_Server-0.11.5/Server/Driver/Sequential.php

Class Overview

PEAR
   |
   --Net_Server_Driver
      |
      --Net_Server_Driver_Sequential

Sequential server class.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: Net_Server_Driver

Net_Server_Driver::getLastSocketError()
return string for last socket error
Net_Server_Driver::setCallbackObject()
register a callback object
Net_Server_Driver::setDebugMode()
Set debug mode
Net_Server_Driver::_sendDebugMessage()
send a debug message

Class Details

[line 57]
Sequential server class.

This class will handles all connection in one server process. This allows you to build servers, where communication between the clients is easy. The drawback is that clients are served sequentially (hence the name). If you send large blocks of data to a client, the others will have to wait. For servers where communication between clients is not needed, use Net_Server_Fork instead.

Events that can be handled:

  • onStart
  • onConnect
  • onConnectionRefused
  • onClose
  • onReceiveData
  • onShutdown



[ Top ]


Class Variables

$clients =  0

[line 63]

amount of clients

Type:   integer


[ Top ]



Method Detail

broadcastData   [line 270]

void broadcastData( string $data, [array $exclude = array()])

send data to all clients
  • Access: public

Parameters:

string   $data   —  data to send
array   $exclude   —  client ids to exclude

[ Top ]

closeConnection   [line 306]

void closeConnection( [ $id = 0], int $clientID)

close connection to a client
  • Access: public

Parameters:

int   $clientID   —  internal ID of the client
   $id   — 

[ Top ]

getClientInfo   [line 292]

array getClientInfo( int $clientId)

get current information about a client
  • Return: information about the client
  • Access: public

Parameters:

int   $clientId   —  ID of the client

[ Top ]

getClients   [line 235]

int getClients( )

get current amount of clients
  • Return: amount of clients
  • Access: public

[ Top ]

isConnected   [line 221]

boolean isConnected( integer $id)

check, whether a client is still connected
  • Return: true if client is connected, false otherwise
  • Access: public

Parameters:

integer   $id   —  client id

[ Top ]

sendData   [line 248]

void sendData( int $clientId, string $data, [boolean $debugData = true])

send data to a client
  • Access: public

Parameters:

int   $clientId   —  ID of the client
string   $data   —  data to send
boolean   $debugData   —  flag to indicate whether data that is written to socket should also be sent as debug message

[ Top ]

setMaxClients   [line 71]

void setMaxClients( int $maxClients)

set maximum amount of simultaneous connections
  • Access: public

Parameters:

int   $maxClients   — 

[ Top ]

shutDown   [line 329]

void shutDown( )

shutdown server
  • Access: public

[ Top ]

start   [line 81]

void start( )

start the server
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 13:54:04 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.