added tips to lamer.bash help
[mirrors/Programs.git] / php / skripty / NE_tcp_service_checker.php
CommitLineData
8de51304
H
1<?php\r
2\r
3$address = "google.cz";\r
4$port = "80";\r
5\r
6echo("Service: $address:$port Running: ");\r
7\r
8$master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);\r
9socket_set_option($master, SOL_SOCKET,SO_REUSEADDR, 1);\r
10// socket_set_option($master, SOL_SOCKET, SO_SNDTIMEO, 10); //Pokus nastavit timeout\r
11\r
12if (socket_connect($master, $address, $port)) { //Podařilo se inicializovat spojení?\r
13 echo("1Yeah!\n"); //Ano\r
14 socket_close($master);\r
15} else {\r
16 echo("1No!\n"); //Ne\r
17}\r
18\r
19if (socket_write ($master, "TEST")) { //Podařilo se inicializovat spojení?\r
20 echo("2Yeah!\n"); //Ano\r
21 socket_close($master);\r
22} else {\r
23 echo("2No!\n"); //Ne\r
24}\r
25\r
26?>\r
This page took 0.568745 seconds and 4 git commands to generate.