File "udp4.php"

Full path: /www/upfile/WebGLData/udp4.php
File size: 603 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Back

<?php

//引数を取得
$port = $argv[1];
$file_name = $argv[2];
//$port = 51237;

//print $port ."\n";
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_bind($socket, '0.0.0.0', $port);

//CSV出力先
//ディレクトリ
$dir = "/www/upfile/" .$file_name;
$log_output_dir = "";

if($port)
{
	for (;;) {
	    socket_recvfrom($socket, $buf, 1024, 0, $remoteAddr, $remotePort);
		file_put_contents($dir, $buf , LOCK_EX);
	}
}
/*
書き換え後、コマンド画面から以下のコマンドを張り付けて実行
nohup php ./udp.php < /dev/null > batchout.log 2> batcherr.log &
*/
?>


PHP File Manager