Overview

Packages

  • None
  • thrift
    • transport

Classes

  • TBufferedTransport
  • TFramedTransport
  • THttpClient
  • TMemoryBuffer
  • TNullTransport
  • TPhpStream
  • TSocket
  • TSocketPool
  • TTransport
  • Overview
  • Package
  • Class
  • Tree

Class TSocket

Sockets implementation of the TTransport interface.

TTransport
Extended by TSocket

Direct known subclasses

TSocketPool
Package: thrift\transport
Author: Mark Slee mcslee@facebook.com
Located at Horde/Thrift/thrift_root/transport/TSocket.php
Methods summary
public
# __construct( string $host = 'localhost', integer $port = 9090, boolean $persist = FALSE, string $debugHandler = null )

Socket constructor

Socket constructor

Parameters

$host
Remote hostname
$port
Remote port
$persist
Whether to use a persistent socket
$debugHandler
Function to call for error logging
public
# setSendTimeout( integer $timeout )

Sets the send timeout.

Sets the send timeout.

Parameters

$timeout
public
# setRecvTimeout( integer $timeout )

Sets the receive timeout.

Sets the receive timeout.

Parameters

$timeout
public
# setDebug( boolean $debug )

Sets debugging output on or off

Sets debugging output on or off

Parameters

$debug
public string
# getHost( )

Get the host that this socket is connected to

Get the host that this socket is connected to

Returns

string
host
public integer
# getPort( )

Get the remote port that this socket is connected to

Get the remote port that this socket is connected to

Returns

integer
port
public boolean
# isOpen( )

Tests whether this is open

Tests whether this is open

Returns

boolean
true if the socket is open
public
# open( )

Connects the socket.

Connects the socket.

Throws

TTransportException
if cannot open
public
# close( )

Closes the socket.

Closes the socket.

public string
# readAll( integer $len )

Uses stream get contents to do the reading

Uses stream get contents to do the reading

Parameters

$len
How many bytes

Returns

string
Binary data

Throws

TTransportException
if cannot read data

Overrides

TTransport::readAll()
public string
# read( integer $len )

Read from the socket

Read from the socket

Parameters

$len
How many bytes

Returns

string
Binary data

Throws

TTransportException
if cannot read any more data
public
# write( string $buf )

Write to the socket.

Write to the socket.

Parameters

$buf
The data to write

Throws

TTransportException
if writing fails
public
# flush( )

Flush output to the socket.

Flush output to the socket.

Throws

TTransportException
if a writing error occurs

Overrides

TTransport::flush()
API documentation generated by ApiGen