Non-blocking socket and TLS functionality for PHP based on Amp.
v2.0
of amphp/dns
DnsException
being thrown from DnsSocketConnector
if DNS resolution failed. A ConnectException
will be thrown instead with the DnsException
as the previous exceptionResourceSocket
if TLS setup failsv2.0
of amphp/byte-stream
by updating ResourceSocket
to implement Traversable
.InternetAddress::fromString
always failing (https://github.com/amphp/socket/pull/94)Update for Closable
interface being moved from amphp/byte-stream
to amphp/amp
.
SocketServer
and DatagramSocket
now extend Amp\Closable
instead of Amp\ByteStream\Closable
.EAGAIN
, e.g. WindowsUpdated interfaces extending ClosableStream
(which was renamed to Closable
in amphp/byte-stream) to include the onClose
method which was added to the interface.
SocketAddress
has been changed to an interface with two implementations - InternetAddress
and UnixAddress
. These can be differentiated using SocketAddress::getType()
, which returns an enum SocketAddressType
with cases Unix
and Internet
.
SocketAddress
static constructors have been relocated as functions in the Amp\Socket\SocketAddress
namespace.
DnsSocketConnector
now tries each host returned from a DNS query a single time before failing. Retrying the list is accomplished through a new connector implementation, RetrySocketConnector
that can be configured to retry a given number of times with an exponential backoff between attempts.
Max attempts has been removed from ConnectContext
in favor of a constructor parameter to RetrySocketConnector
.
Added SocketServerFactory
interface for creating SocketServer
instances, along with an implementation ResourceSocketServerFactory
.
EncryptableSocket::getTlsState()
now returns an enum TlsState
with cases corresponding to the prior constants defined in EncryptableSocket
, which have been removed.
ServerSocket::getBindContext()
BindContext
in ResourceSocketServer::__construct()
ServerTlsContext::fromServerResource()
DnsSocketConnector
error messages to include IP addressesbindTo
option is used for connectionsrevolt/event-loop
0.2.xPromise
connectTls
functionbindDatagram
functionResourceDatagramSocket
and DatagramSocket
interfacecreatePair
function to createSocketPair
connector
function to socketConnector
Server
to ResourceSocketServer
and introduced SocketServer
interfaceConnector
to SocketConnector
DnsConnector
to DnsSocketConnector
StaticConnector
to StaticSocketConnector
BindContext
, use parameters on listen
/ bindDatagram
instead