Socket¶
-
php\net\Socket Class Socket
Methods
__construct($host = null, $port = null)¶
Параметры:
- $host –
null,string- $port –
null,int
getOutput()¶throws php\io\IOException
Результат: php\io\MiscStream
getInput()¶throws php\io\IOException
Результат: php\io\MiscStream
getLocalAddress()¶
Результат: string
getAddress()¶
Результат: string
getLocalPort()¶
Результат: int
getPort()¶
Результат: int
close()¶throws php\io\IOException
shutdownInput()¶throws php\io\IOException
shutdownOutput()¶throws php\io\IOException
isConnected()¶
Результат: bool
isClosed()¶
Результат: bool
isBound()¶
Результат: bool
isInputShutdown()¶
Результат: bool
isOutputShutdown()¶
Результат: bool
connect($hostname, $port, $timeout = null)¶Connects this socket to the server
Параметры:
- $hostname –
string- $port –
int- $timeout –
null,int
bind($hostname, $port)¶Binds the socket to a local address.
throws php\net\SocketException
Параметры:
- $hostname –
string- $port –
int
bindDefault()¶
setSoTimeout($timeout)¶Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds.
throws php\net\SocketException
Параметры:
- $timeout –
int
setSoLinger($on, $linger)¶throws php\net\SocketException
Параметры:
- $on –
bool- $linger –
int
setReuseAddress($on)¶Enable/disable the SO_REUSEADDR socket option.
throws php\net\SocketException
Параметры:
- $on –
bool
setReceiveBufferSize($size)¶throws php\net\SocketException
Параметры:
- $size –
int
setTcpNoDelay($on)¶throws php\net\SocketException
Параметры:
- $on –
bool
setKeepAlive($on)¶throws php\net\SocketException
Параметры:
- $on –
bool
setOOBInline($on)¶throws php\net\SocketException
Параметры:
- $on –
bool
setSendBufferSize($size)¶throws php\net\SocketException
Параметры:
- $size –
int
setTrafficClass($tc)¶Sets traffic class or type-of-service octet in the IP header for packets sent from this Socket.
Параметры:
- $tc –
int
setPerformancePreferences($connectTime, $latency, $bandWidth)¶Sets performance preferences for this ServerSocket.
! Not implemented yet for TCP/IP
Параметры:
- $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
Параметры:
- $data –
int