Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: c:/www/apache/doc2//pear/Net/Socket.php
PEAR 2000/12/03 -

Net_Socket

PEAR
   |
  +-- Net_Socket

Generalized Socket class. More docs to be written.

 

private class Net_Socket extends PEAR

Generalized Socket class. More docs to be written.

AuthorsStig Bakken <ssb@fast.no>, Chuck Hagenbuch <chuck@horde.org>
SincePHP 4.0.2
Version0.2

 

Methods inherited from PEAR

pear, _pear, iserror, _pear_call_destructors

Public Method Summary

void

Net_Socket()

Constructs a new Net_Socket object.
mixed

connect(string $addr, int $port, [ boolean $persistent, boolean $timeout ])

Connect to the specified port. If called when the socket is
mixed

disconnect()

Disconnects from the peer, closes the socket.
bool

isBlocking()

Find out if the socket is in blocking mode.
void

setBlocking(bool $mode)

Sets whether the socket connection should be blocking or
void

read( $size)

Read a specified amount of data. This is guaranteed to return,
mixed

writeLine( $data)

Write a line of data to the socket, followed by a trailing "\r\n".
void

readLine()

Read until either the end of the socket or a newline, whichever
void

readAll()

Read until the socket closes. THIS FUNCTION WILL NOT EXIT if the

Private Method Summary

void

gets( $size)

Warning: documentation is missing.
void

write( $data)

Warning: documentation is missing.
void

eof()

Warning: documentation is missing.
void

readByte()

Warning: documentation is missing.
void

readWord()

Warning: documentation is missing.
void

readInt()

Warning: documentation is missing.
void

readString()

Warning: documentation is missing.
void

readIPAddress()

Warning: documentation is missing.

Fields inherited from PEAR

$_debug

Private Field Summary

string

$fp

Socket file pointer. *
boolean

$blocking

Whether the socket is blocking. *
unknown

$persistent

Whether the socket is persistant. *
string

$addr

The IP address to connect to. *
integer

$port

The port number to connect to. *
boolean

$timeout

Number of seconds to wait on socket connections before
integer

$lineLength

Number of bytes to read at a time in readLine() and

Public Method Details

Net_Socket

public void Net_Socket( )

  Constructs a new Net_Socket object.

Returns void


connect

public mixed connect( string $addr, int $port, [ boolean $persistent, boolean $timeout ] )

  Connect to the specified port. If called when the socket is
already connected, it disconnects and connects again.

Parameter
string $addr
address or host name
int $port
port number
boolean $persistent = >>false<<
(optional) whether the connection is
persistent (kept open between requests by the web server)
boolean $timeout = >>false<<
(optional) how long to wait for data
Returns mixed

true on success or error object


disconnect

public mixed disconnect( )

  Disconnects from the peer, closes the socket.

Returns mixed

true on success or an error object otherwise


isBlocking

public bool isBlocking( )

  Find out if the socket is in blocking mode.

Returns bool

the current blocking mode.


setBlocking

public void setBlocking( bool $mode )

  Sets whether the socket connection should be blocking or
not. A read call to a non-blocking socket will return immediatelyif there is no data available, whereas it will block until thereis data for blocking sockets.

Parameter
bool $mode
for blocking sockets, false for nonblocking
Returns void


read

public void read( $size )

  Read a specified amount of data. This is guaranteed to return,
and has the added benefit of getting everything in one fread()chunk; if you know the size of the data you're gettingbeforehand, this is definitely the way to go.

Parameter
$size
Warning: documentation is missing.
Returns void


writeLine

public mixed writeLine( $data )

  Write a line of data to the socket, followed by a trailing "\r\n".

Parameter
$data
Warning: documentation is missing.
Returns mixed

fputs result, or an error


readLine

public void readLine( )

  Read until either the end of the socket or a newline, whichever
comes first. Strips the trailing newline from the returned data.

Returns void


readAll

public void readAll( )

  Read until the socket closes. THIS FUNCTION WILL NOT EXIT if the
socket is in blocking mode until the socket closes.

Returns void


Private Method Details

gets

private void gets( $size )

 

Warning: documentation is missing.

Parameter
$size
Warning: documentation is missing.
Returns void


write

private void write( $data )

 

Warning: documentation is missing.

Parameter
$data
Warning: documentation is missing.
Returns void


eof

private void eof( )

 

Warning: documentation is missing.

Returns void


readByte

private void readByte( )

 

Warning: documentation is missing.

Returns void


readWord

private void readWord( )

 

Warning: documentation is missing.

Returns void


readInt

private void readInt( )

 

Warning: documentation is missing.

Returns void


readString

private void readString( )

 

Warning: documentation is missing.

Returns void


readIPAddress

private void readIPAddress( )

 

Warning: documentation is missing.

Returns void


Private Field Details

$fp

private string $fp

>>null<<

Socket file pointer. *


$blocking

private boolean $blocking

>>true<<

Whether the socket is blocking. *


$persistent

private unknown $persistent

>><<

Whether the socket is persistant. *


$addr

private string $addr

>>''<<

The IP address to connect to. *


$port

private integer $port

>><<

The port number to connect to. *


$timeout

private boolean $timeout

>>false<<

Number of seconds to wait on socket connections before
assuming there's no more data. *


$lineLength

private integer $lineLength

>>2048<<

Number of bytes to read at a time in readLine() and
readAll(). *



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta