upd sockets

From: Date: Mon, 10 Sep 2007 16:06:30 +0000
Subject: upd sockets
Groups: php.general 
Request: Send a blank email to php-general+get-261917@lists.php.net to get a copy of this message
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

« previous php.general (#261917) next »