Hello!
I'm running PHP4 under IIS windows pro 2000
From the following code i got a msg:
Fatal error: Call to undefined function: socket() in c:\inetpub\wwwroot\Ice\php\Socket_Server.php on line 9
This is the code any help
<?php
error_reporting (E_ALL);
/ Allow the script to hang around waiting for connections. /
set_time_limit (0);
$address = '192.168.1.53';
$port = 10000;
if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
echo "socket() failed: reason: " . strerror ($sock) . "\n";
}
if (($ret = bind ($sock, $address, $port)) < 0) {
echo "bind() failed: reason: " . strerror ($ret) . "\n";
}
if (($ret = listen ($sock, 5)) < 0) {
echo "listen() failed: reason: " . strerror ($ret) . "\n";
}
do {
if (($msgsock = accept_connect($sock)) < 0) {
echo "accept_connect() failed: reason: " . strerror ($msgsock) . "\n";
break;
}
do {
$buf = '';
$ret = read ($msgsock, $buf, 2048);
if ($ret < 0) {
echo "read() failed: reason: " . strerror ($ret) . "\n";
break 2;
}
if ($ret == 0) {
break 2;
}
$buf = trim ($buf);
if ($buf == 'quit') {
close ($msgsock);
break 2;
}
$talkback = "PHP: You said '$buf'.\n";
write ($msgsock, $talkback, strlen ($talkback));
echo "$buf\n";
} while (true);
close ($msgsock);
} while (true);
close ($sock);
?>
Thank's in advance.
Mohammed El Abbassi.