12 error_reporting(E_ALL);
17 $address =
'127.0.0.1';
20 if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) ===
false)
22 echo
"socket_create() failed: reason: " . socket_strerror(socket_last_error()) .
"<br>\n";
26 if ($result ===
false)
28 echo
"<h2>Connection to the scheduler failed. Is the scheduler running?</h2>";
29 echo
"socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($sock)) .
"<br>\n";
34 echo
"Connected to scheduler at '$address' on port '$port'...<br>";
38 socket_write($sock, $msg, strlen($msg));
40 while ($buf = socket_read($sock, 2048, PHP_NORMAL_READ))
42 if (substr($buf, 0, 3) ==
"end")
break;
43 echo
"Status is:<br>$buf<br>";
46 echo
"Closing socket<br>";
int socket_connect(char *host, char *port)
Create a socket connection.