Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | include "/home/us3/bin/listen-config.php";
|
---|
4 |
|
---|
5 | $socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
|
---|
6 |
|
---|
7 | // Listen on all interfaces
|
---|
8 | if ( ! socket_bind( $socket, 0, $listen_port ) )
|
---|
9 | {
|
---|
10 | $msg = "listen bind failed: " . socket_strerror( socket_last_error( $socket ) );
|
---|
11 | write_log( "$self: $msg" );
|
---|
12 | exit();
|
---|
13 | };
|
---|
14 |
|
---|
15 | $handle = fopen( $pipe, "r+" );
|
---|
16 |
|
---|
17 | $php = "/usr/bin/php";
|
---|
18 |
|
---|
19 | $cmd = "nohup $php $home/bin/manage-us3-pipe.php >>$home/etc/manage.log 2>&1 </dev/null &";
|
---|
20 |
|
---|
21 | exec( $cmd );
|
---|
22 |
|
---|
23 | do
|
---|
24 | {
|
---|
25 | socket_recvfrom( $socket, $buf, 200, 0, $from, $port );
|
---|
26 | fwrite( $handle, $buf . chr( 0 ) );
|
---|
27 |
|
---|
28 | } while ( trim( $buf ) != "Stop listen" );
|
---|
29 |
|
---|
30 | socket_close( $socket );
|
---|
31 | ?>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.