dooaki / net-empty_port
find a free TCP/UDP port
0.0.2
2013-10-02 06:50 UTC
Requires
- php: >=5.3.0
- ext-sockets: *
Requires (Dev)
- phpunit/php-invoker: >=1.1.0,<1.2.0
- phpunit/phpunit: 3.7.*@stable
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2024-11-18 15:49:49 UTC
README
Net-EmptyPort is php library finding an empty TCP/UDP port.
Original is cpan module Net::EmptyPort
Requirements
- PHP 5.3 or later
- Sockets Support enabled (--enable-sockets)
Installation
you can install the script with Composer.
in your composer.json
file:
{
"require": {
"dooaki/net-empty_port": "dev-master"
}
}
composer.phar install
Methods
find([$port, $proto])
find free TCP port
use dooaki\Net\EmptyPort;
$port = EmptyPort::find(5963); // 5963..65535
find free UDP port
$port = EmptyPort::find(null, 'udp'); // 1024..65535
isPortUsed($port, [$proto])
checks the given port is already used. also works for UDP
$dns_udp_used = EmptyPort::isPortUsed(53, 'udp');
wait($port, $max_wait_sec[, $protol])
wait for a particular port is available for connect.
Author
do_aki <do.hiroaki at gmail.com>
License
MIT License