File: skipifconnect.inc

package info (click to toggle)
php-gearman 2.0.2%2B1.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 868 kB
  • ctags: 723
  • sloc: ansic: 7,092; php: 826; xml: 570; sh: 32; makefile: 1
file content (23 lines) | stat: -rw-r--r-- 471 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

require_once('connect.inc');

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($sock === false) {
    die("skip unable to create socket");
}

if (socket_connect($sock, $host, $port) !== true) {
    die("skip unable to connect");
}

$command = "getpid\n";
if (socket_write($sock, $command) !== strlen($command)) {
    die("skip unable to write getpid");
}

if (socket_read($sock, 8) === false) {
    die("skip unable to read pid");
}

socket_close($sock);