CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (GitHub)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • Slack
    • Paid Support
CakePHP

C CakePHP 2.2 API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 2.2
      • 4.2
      • 4.1
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Packages

  • Cake
    • Cache
      • Engine
    • Configure
    • Console
      • Command
        • Task
    • Controller
      • Component
        • Acl
        • Auth
    • Core
    • Error
    • Event
    • I18n
    • Log
      • Engine
    • Model
      • Behavior
      • Datasource
        • Database
        • Session
      • Validator
    • Network
      • Email
      • Http
    • Routing
      • Filter
      • Route
    • TestSuite
      • Coverage
      • Fixture
      • Reporter
    • Utility
    • View
      • Helper

Classes

  • CakeRequest
  • CakeResponse
  • CakeSocket

Class CakeSocket

Cake network socket connection class.

Core base class for network communication.

Direct Subclasses
  • HttpSocket
Package: Cake\Network
Copyright: Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Network/CakeSocket.php

Properties summary

  • $_baseConfig protected
    array
    Base configuration settings for the socket connection
  • $config public
    array
    Configuration settings for the socket connection
  • $connected public
    boolean
    This boolean contains the current state of the CakeSocket class
  • $connection public
    resource
    Reference to socket connection resource
  • $description public
    string
    Object description
  • $lastError public
    array
    This variable contains an array with the last error number (num) and string (str)

Method Summary

  • __construct() public
    Constructor.
  • __destruct() public
    Destructor, used to disconnect from current connection.
  • address() public
    Get the IP address of the current connection.
  • addresses() public
    Get all IP addresses associated with the current connection.
  • connect() public
    Connect the socket to the given host and port.
  • disconnect() public
    Disconnect the socket from the current connection.
  • host() public
    Get the host name of the current connection.
  • lastError() public
    Get the last error as a string.
  • read() public

    Read data from the socket. Returns false if no data is available or no connection could be established.

  • reset() public
    Resets the state of this Socket instance to it's initial state (before Object::__construct got executed)
  • setLastError() public
    Set the last error.
  • write() public
    Write data to the socket.

Method Detail

__construct() public ¶

__construct( array $config = array() )

Constructor.

Parameters
array $config optional array()
Socket configuration, which will be merged with the base configuration
See
CakeSocket::$_baseConfig

__destruct() public ¶

__destruct( )

Destructor, used to disconnect from current connection.

address() public ¶

address( )

Get the IP address of the current connection.

Returns
string
IP address

addresses() public ¶

addresses( )

Get all IP addresses associated with the current connection.

Returns
array
IP addresses

connect() public ¶

connect( )

Connect the socket to the given host and port.

Returns
boolean
Success
Throws
SocketException

disconnect() public ¶

disconnect( )

Disconnect the socket from the current connection.

Returns
boolean
Success

host() public ¶

host( )

Get the host name of the current connection.

Returns
string
Host name

lastError() public ¶

lastError( )

Get the last error as a string.

Returns
string
Last error

read() public ¶

read( integer $length = 1024 )

Read data from the socket. Returns false if no data is available or no connection could be established.

Parameters
integer $length optional 1024
Optional buffer length to read; defaults to 1024
Returns
mixed
Socket data

reset() public ¶

reset( array $state = null )

Resets the state of this Socket instance to it's initial state (before Object::__construct got executed)

Parameters
array $state optional null
Array with key and values to reset
Returns
boolean
True on success

setLastError() public ¶

setLastError( integer $errNum , string $errStr )

Set the last error.

Parameters
integer $errNum
Error code
string $errStr
Error string

write() public ¶

write( string $data )

Write data to the socket.

Parameters
string $data
The data to write to the socket
Returns
boolean
Success

Properties detail

$_baseConfig ¶

protected array

Base configuration settings for the socket connection

array(
    'persistent'    => false,
    'host'          => 'localhost',
    'protocol'      => 'tcp',
    'port'          => 80,
    'timeout'       => 30
)

$config ¶

public array

Configuration settings for the socket connection

array()

$connected ¶

public boolean

This boolean contains the current state of the CakeSocket class

false

$connection ¶

public resource

Reference to socket connection resource

null

$description ¶

public string

Object description

'Remote DataSource Network Socket Interface'

$lastError ¶

public array

This variable contains an array with the last error number (num) and string (str)

array()
OpenHub
Rackspace
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (GitHub)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • Slack
  • Paid Support

Generated using CakePHP API Docs