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

Class: System_Socket_Connection

Source Location: /System_Socket-0.4.0/Socket/Connection.php

Class Overview

PEAR
   |
   --System_Socket_Manager
      |
      --System_Socket_Connection

System_Socket_Connection


Author(s):

Version:

  • $Revision: 1.14 $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 38]
System_Socket_Connection
  • Author: Michael Wallner <mike@php.net>
  • Version: $Revision: 1.14 $
  • Access: public


[ Top ]


Class Variables

$ID =  null

[line 45]

Connection ID
  • Access: protected

Type:   string


[ Top ]

$peerHost =  ''

[line 52]

Peer host
  • Access: public

Type:   mixed


[ Top ]

$peerPort =  0

[line 59]

Peer port
  • Access: public

Type:   mixed


[ Top ]



Method Detail

System_Socket_Connection (Constructor)   [line 71]

object System_Socket_Connection System_Socket_Connection( &$socket, object $socket)

Constructor

Instantiate a new System_Socket_Connection object with the underlying System_Socket object $socket.

  • Access: public

Parameters:

object   $socket   —  System_Socekt object
   &$socket   — 

[ Top ]

getBlocking   [line 144]

bool getBlocking( )

Get socket blocking

Get the blocking mode of the underlying System_Socket.

  • Access: public

[ Top ]

getID   [line 103]

string getID( )

Get connection ID

Each connection is represented by a unique id.

  • Access: public

[ Top ]

isConnected   [line 117]

bool isConnected( )

Check if wer're connected

Check if the System_Socket_Connection is still connected. Actually we check if the underlying socket resource handle is still valid.

  • Access: public

[ Top ]

read   [line 267]

mixed read( [int $length = 4096])

Read through connection

Attempts to read $length length of data through the socket connection.

  • Return: read data or false
  • Access: public

Parameters:

int   $length   —  bytes to read

[ Top ]

readByte   [line 294]

int readByte( )

Read byte

Reads a byte from the socket and returns its integer representation.

  • Access: public

[ Top ]

readChar   [line 281]

string readChar( )

Read char

Reads a single character from the socket resource.

  • Access: public

[ Top ]

readDelim   [line 310]

string readDelim( string $delim, [string $escape = '\\'])

Read until delimiter

Reads from the socket until the first occurence of the delimiter $delim. Be aware that the delimiter is part of the returned string.

  • Access: public

Parameters:

string   $delim   — 
  1. character string
string   $escape   —  escape character

[ Top ]

readInt   [line 348]

int readInt( )

Read integer

Read a 32 bit network byte order integer (4 bytes).

  • Access: public

[ Top ]

readLine   [line 335]

string readLine( [string $LF = "\n"])

Read line

Be aware, that the linefeed character doesn't get truncated.

  • Access: public

Parameters:

string   $LF   — 

[ Top ]

readString   [line 363]

string readString( )

Read NUL terminated string

Reads a string terminated wit a NUL byte from the socket resource. Be aware, that the NUL byte will *NOT* be truncated.

  • Access: public

[ Top ]

setBlocking   [line 130]

bool setBlocking( $blocking)

Set socket blocking

Set the blocking mode of the underlying System_Socket.

  • Access: public

Parameters:

   $blocking   — 

[ Top ]

write   [line 158]

mixed write( string $data)

Write through connection

Write data through the socket connection.

  • Return: int bytes written or false
  • Access: public

Parameters:

string   $data   — 

[ Top ]

writeByte   [line 183]

mixed writeByte( int $byte)

Write byte
  • Access: public

Parameters:

int   $byte   — 

[ Top ]

writeChar   [line 171]

mixed writeChar( string $char)

Write char (chr(byte))
  • Access: public

Parameters:

string   $char   — 

[ Top ]

writeDelim   [line 200]

mixed writeDelim( $data, string $delim, [bool $escape = true])

Write data with ending delimter

Write a string terminated by the specified delimiter

  • Access: public

Parameters:

string   $delim   —  delimiter to append
bool   $escape   —  whether to escape all delimiter characters ($delim) conatained in $data
   $data   — 

[ Top ]

writeInt   [line 236]

mixed writeInt( int $int)

Write integer

Write an 32 bit network byte order integer (4 bytes).

  • Access: public

Parameters:

int   $int   — 

[ Top ]

writeLine   [line 221]

mixed writeLine( [string $line = ''], [string $LF = "\n"], [bool $escape = true])

Write a line

Write a line of data terminated with the specified linefeed character.

  • Access: public

Parameters:

string   $line   —  line of data
string   $LF   —  linefeed character
bool   $escape   —  whether to escape all linefeed characters ($LF) contained in $line

[ Top ]

writeString   [line 252]

mixed writeString( string $string, [bool $escape = true])

Write string terminated by NUL

Write a string which will be terminated by a NUL byte.

  • Access: public

Parameters:

string   $string   —  the string to write
bool   $escape   —  wheter to escape all NULs in $string

[ Top ]


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