Commit | Line | Data |
---|---|---|
8de51304 H |
1 | <?php\r |
2 | \r | |
3 | $address = "google.cz";\r | |
4 | $port = "80";\r | |
5 | \r | |
6 | echo("Service: $address:$port Running: ");\r | |
7 | \r | |
8 | $master = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);\r | |
9 | socket_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 | |
12 | if (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 | |
19 | if (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 |