SafeSocket
class SafeSocket implements SocketInterface
Properties
| protected Channel | $channel | ||
| protected bool | $loop | ||
| protected SocketOptionInterface|null | $option |
Methods
__construct(Socket $socket, int $capacity = 65535, bool $throw = true, LoggerInterface|null $logger = null)
Create a new safe socket instance.
void
getSocketOption()
Get the socket option.
false|int
sendAll(string $data, float $timeout = 0)
Send all data to the socket.
false|string
recvAll(int $length = 65536, float $timeout = 0)
Receive all data from the socket.
false|string
recvPacket(float $timeout = 0)
Receive a packet from the socket.
bool
close()
Close the socket.
setLogger(LoggerInterface|null $logger)
Set the logger.
void
loop()
Start the send loop.
Details
at line 26
__construct(Socket $socket, int $capacity = 65535, bool $throw = true, LoggerInterface|null $logger = null)
Create a new safe socket instance.
at line 38
void
setSocketOption(SocketOptionInterface $option)
Set the socket option.
at line 46
SocketOptionInterface|null
getSocketOption()
Get the socket option.
at line 57
false|int
sendAll(string $data, float $timeout = 0)
Send all data to the socket.
at line 81
false|string
recvAll(int $length = 65536, float $timeout = 0)
Receive all data from the socket.
at line 107
false|string
recvPacket(float $timeout = 0)
Receive a packet from the socket.
at line 130
bool
close()
Close the socket.
at line 140
SafeSocket
setLogger(LoggerInterface|null $logger)
Set the logger.
at line 149
protected void
loop()
Start the send loop.