Socket¶
-
php\net\Socket Class Socket
Methods
__construct($host = null, $port = null)¶
Parameters:
- $host – null, string
- $port – null, int
getOutput()¶throws php\io\IOException
Returns: php\io\MiscStream
getInput()¶throws php\io\IOException
Returns: php\io\MiscStream
getLocalAddress()¶
Returns: string
getAddress()¶
Returns: string
getLocalPort()¶
Returns: int
getPort()¶
Returns: int
close()¶throws php\io\IOException
shutdownInput()¶throws php\io\IOException
shutdownOutput()¶throws php\io\IOException
isConnected()¶
Returns: bool
isClosed()¶
Returns: bool
isBound()¶
Returns: bool
isInputShutdown()¶
Returns: bool
isOutputShutdown()¶
Returns: bool
connect($hostname, $port, $timeout = null)¶Connects this socket to the server
Parameters:
- $hostname – string
- $port – int
- $timeout – null, int
bind($hostname, $port)¶Binds the socket to a local address.
throws php\net\SocketException
Parameters:
- $hostname – string
- $port – int
bindDefault()¶
setSoTimeout($timeout)¶Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
throws php\net\SocketException
Parameters:
- $timeout – int
setSoLinger($on, $linger)¶throws php\net\SocketException
Parameters:
- $on – bool
- $linger – int
setReuseAddress($on)¶Enable/disable the SO_REUSEADDR socket option.
throws php\net\SocketException
Parameters:
- $on – bool
setReceiveBufferSize($size)¶throws php\net\SocketException
Parameters:
- $size – int
setTcpNoDelay($on)¶throws php\net\SocketException
Parameters:
- $on – bool
setKeepAlive($on)¶throws php\net\SocketException
Parameters:
- $on – bool
setOOBInline($on)¶throws php\net\SocketException
Parameters:
- $on – bool
setSendBufferSize($size)¶throws php\net\SocketException
Parameters:
- $size – int
setTrafficClass($tc)¶Sets traffic class or type-of-service octet in the IP header for packets sent from this Socket.
Parameters:
- $tc – int
setPerformancePreferences($connectTime, $latency, $bandWidth)¶Sets performance preferences for this ServerSocket.
! Not implemented yet for TCP/IP
Parameters:
- $connectTime – int
- $latency – int
- $bandWidth – int
sendUrgentData($data)¶Send one byte of urgent data on the socket. The byte to be sent is the lowest eight bits of the data parameter.
throws php\net\SocketException
Parameters:
- $data – int