If socket connection is required by libyate.php check if the PHP sockets extension is loaded.

git-svn-id: http://voip.null.ro/svn/yate@5411 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2013-02-15 10:10:38 +00:00
parent 0eb5df5f89
commit b76cc849fe
1 changed files with 6 additions and 1 deletions

View File

@ -449,8 +449,14 @@ class Yate
$yate_stdout = false;
$yate_stderr = false;
$yate_output = false;
$yate_socket = false;
if ($addr) {
$ok = false;
if (!function_exists("socket_create")) {
$yate_stderr = fopen("php://stderr","w");
Yate::Output("PHP sockets missing, initialization failed");
return false;
}
if ($port) {
$yate_socket = @socket_create(AF_INET,SOCK_STREAM,SOL_TCP);
$ok = @socket_connect($yate_socket,$addr,$port);
@ -468,7 +474,6 @@ class Yate
$yate_output = true;
}
else {
$yate_socket = false;
$yate_stdin = fopen("php://stdin","r");
$yate_stdout = fopen("php://stdout","w");
$yate_stderr = fopen("php://stderr","w");