upd sockets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,
i have got a problem and cannot find answer.
I have got an process which sends real time data per udp. i can catch this packets and write to a site with php and sockets.

CODE
<?php
	define('LISTEN_IP',    '0.0.0.0');
	define('LISTEN_PORT',    52700);
	define('PACKET_SIZE',    1024);
	include("common.inc");
	
	
if ( $socket = @stream_socket_server('udp://'.LISTEN_IP.':'.LISTEN_PORT, $errno, $errstr, STREAM_SERVER_BIND) ) {
	
?>

<html>
<head>
	<title>php-test</title>
	<script language=JavaScript>
		function alarma() {
			alert("ARLAMA: <?php echo getAPaket() ?>");
		}
		</script>


</head>


<body>
<h2>Welcome to me</h2>
<p>listen to port 52776</p>
<?php
		
	echo 'used socket '.$socket;	
	$packet = '';
	$ilauf = 0;
	while ($ilauf < 10) {
		//$buff = stream_socket_recvfrom($socket, PACKET_SIZE, 0, $remote_ip);
		$buff = stream_socket_recvfrom($socket, PACKET_SIZE, STREAM_OOB);
   	   	
   	$packet .= $buff.'<br><br>';
   	$ilauf++;
   	echo 'current paketnummer is:'.$ilauf.'<br>';
   	echo 'current paket content:'.$buff.'<br><br>';      		
   }
   	
    fclose($socket);echo getAPaket();
}
EDOC

In this example i read ONLY 10 packets BUT i want to read the data continuous AND write the last received packet into a table. Now,
i write the data among each other. need a good idea! Ajax? js?
i thing, that the biggest prob. is that php is server sided a php
cleint sided...

Any IDEA??? Please answer here AND write an email to me. Because i ve
only an modem ;-( "wanscha @ web.de"

THX
dave

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux