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