source: trunk/listen.php@ 8

Last change on this file since 8 was 6, checked in by gegorbet, 10 years ago

changes since 2013, mostly for airvata/thrift

File size: 673 bytes
Line 
1<?php
2
3include "/export/home/us3/bin/listen-config.php";
4
5$socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
6
7// Listen on all interfaces
8if ( ! 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 = "/usr/bin/nohup $php $home/bin/manage-us3-pipe.php >>$home/etc/manage.log 2>&1 </dev/null &";
20
21exec( $cmd );
22
23do
24{
25 socket_recvfrom( $socket, $buf, 200, 0, $from, $port );
26 fwrite( $handle, $buf . chr( 0 ) );
27
28} while ( trim( $buf ) != "Stop listen" );
29
30socket_close( $socket );
31?>
Note: See TracBrowser for help on using the repository browser.