Skip to content

Commit

Permalink
Merge pull request #88 from clue-labs/examples
Browse files Browse the repository at this point in the history
Fix examples to use updated API
  • Loading branch information
WyriHaximus authored Mar 9, 2017
2 parents 7dc5721 + 8d6921f commit dcac545
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/01-http.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// time out connection attempt in 3.0s
$dns = new TimeoutConnector($dns, 3.0, $loop);

$dns->create('www.google.com', 80)->then(function (ConnectionInterface $connection) {
$dns->connect('www.google.com:80')->then(function (ConnectionInterface $connection) {
$connection->on('data', function ($data) {
echo $data;
});
Expand Down
2 changes: 1 addition & 1 deletion examples/02-https.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// time out connection attempt in 3.0s
$tls = new TimeoutConnector($tls, 3.0, $loop);

$tls->create('www.google.com', 443)->then(function (ConnectionInterface $connection) {
$tls->connect('www.google.com:443')->then(function (ConnectionInterface $connection) {
$connection->on('data', function ($data) {
echo $data;
});
Expand Down
6 changes: 3 additions & 3 deletions examples/03-netcat.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

require __DIR__ . '/../vendor/autoload.php';

if (!isset($argv[2])) {
fwrite(STDERR, 'Usage error: required arguments <host> <port>' . PHP_EOL);
if (!isset($argv[1])) {
fwrite(STDERR, 'Usage error: required argument <host:port>' . PHP_EOL);
exit(1);
}

Expand All @@ -33,7 +33,7 @@

$stderr->write('Connecting' . PHP_EOL);

$dns->create($argv[1], $argv[2])->then(function (ConnectionInterface $connection) use ($stdin, $stdout, $stderr) {
$dns->connect($argv[1])->then(function (ConnectionInterface $connection) use ($stdin, $stdout, $stderr) {
// pipe everything from STDIN into connection
$stdin->resume();
$stdin->pipe($connection);
Expand Down

0 comments on commit dcac545

Please sign in to comment.