- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
<?php
$socket = stream_socket_server("tcp://127.0.0.1:8982", $errno, $errstr);
if (!$socket)
echo "$errstr ($errno)<br />\n";
while (TRUE){
$conn = stream_socket_accept($socket);
if(pcntl_fork() == -1) {
echo "Sorrr: fork failure!\n";
die();
}
if(pcntl_fork() == 0)
{
fwrite($conn, "Hello!\n");
$input=fread($conn,1024);
fwrite($conn,$input . "\n");
if ($input = "quit")
{
fwrite($conn,"Terminated");
fclose($conn);
fclose($socket);
sleep (5);
exit();
}else{
fwrite($conn,"Enter data:");
}
}
}
fclose($conn);
?>
guest 21.07.2009 13:31 # 0
Шайтанамэ на сервере:)