@@ -76,9 +76,9 @@ $promise->cancel();
76
76
77
77
### Async TCP/IP connections
78
78
79
- The ` React\SocketClient\TcpConnector ` provides a single promise-based
80
- ` create($ip, $port) ` method which resolves as soon as the connection
81
- succeeds or fails.
79
+ The ` React\SocketClient\TcpConnector ` class implements the
80
+ [ ` ConnectorInterface ` ] ( #connectorinterface ) and allows you to create plaintext
81
+ TCP/IP connections to any IP-port-combination:
82
82
83
83
``` php
84
84
$tcpConnector = new React\SocketClient\TcpConnector($loop);
@@ -115,17 +115,18 @@ $tcpConnector = new React\SocketClient\TcpConnector($loop, array(
115
115
));
116
116
```
117
117
118
- Note that this class only allows you to connect to IP/ port combinations.
119
- If you want to connect to hostname/ port combinations, see also the following chapter.
118
+ Note that this class only allows you to connect to IP- port- combinations.
119
+ If you want to connect to hostname- port- combinations, see also the following chapter.
120
120
121
121
### DNS resolution
122
122
123
- The ` DnsConnector ` class decorates a given ` TcpConnector ` instance by first
124
- looking up the given domain name and then establishing the underlying TCP/IP
125
- connection to the resolved IP address .
123
+ The ` DnsConnector ` class implements the
124
+ [ ` ConnectorInterface ` ] ( #connectorinterface ) and allows you to create plaintext
125
+ TCP/IP connections to any hostname-port-combination .
126
126
127
- It provides the same promise-based ` create($host, $port) ` method which resolves with
128
- a ` Stream ` instance that can be used just like above.
127
+ It does so by decorating a given ` TcpConnector ` instance so that it first
128
+ looks up the given domain name via DNS (if applicable) and then establishes the
129
+ underlying TCP/IP connection to the resolved target IP address.
129
130
130
131
Make sure to set up your DNS resolver and underlying TCP connector like this:
131
132
@@ -168,11 +169,13 @@ $connector->create('www.google.com', 80)->then($callback);
168
169
169
170
### Async SSL/TLS connections
170
171
171
- The ` SecureConnector ` class decorates a given ` Connector ` instance by enabling
172
- SSL/TLS encryption as soon as the raw TCP/IP connection succeeds.
172
+ The ` SecureConnector ` class implements the
173
+ [ ` ConnectorInterface ` ] ( #connectorinterface ) and allows you to create secure
174
+ TLS (formerly known as SSL) connections to any hostname-port-combination.
173
175
174
- It provides the same promise- based ` create($host, $port) ` method which resolves with
175
- a ` Stream ` instance that can be used just like any non-encrypted stream:
176
+ It does so by decorating a given ` DnsConnector ` instance so that it first
177
+ creates a plaintext TCP/IP connection and then enables TLS encryption on this
178
+ stream.
176
179
177
180
``` php
178
181
$secureConnector = new React\SocketClient\SecureConnector($dnsConnector, $loop);
@@ -219,8 +222,12 @@ stream resources will use a single, shared *default context* resource otherwise.
219
222
220
223
### Connection timeouts
221
224
222
- The ` TimeoutConnector ` class decorates any given ` Connector ` instance.
223
- It provides the same ` create() ` method, but will automatically reject the
225
+ The ` TimeoutConnector ` class implements the
226
+ [ ` ConnectorInterface ` ] ( #connectorinterface ) and allows you to add timeout
227
+ handling to any existing connector instance.
228
+
229
+ It does so by decorating any given [ ` ConnectorInterface ` ] ( #connectorinterface )
230
+ instance and starting a timer that will automatically reject and abort any
224
231
underlying connection attempt if it takes too long.
225
232
226
233
``` php
@@ -246,8 +253,9 @@ attempt, abort the timer and reject the resulting promise.
246
253
247
254
### Unix domain sockets
248
255
249
- Similarly, the ` UnixConnector ` class can be used to connect to Unix domain socket (UDS)
250
- paths like this:
256
+ The ` UnixConnector ` class implements the
257
+ [ ` ConnectorInterface ` ] ( #connectorinterface ) and allows you to connect to
258
+ Unix domain socket (UDS) paths like this:
251
259
252
260
``` php
253
261
$connector = new React\SocketClient\UnixConnector($loop);
0 commit comments