I have a UDP daemon written in PHP receiving data from remote UDP devices.
$sock = socket_create(AF_INET, SOCK_DGRAM, 0);
socket_bind($sock, 0, $port) or die('Could not bind to address');
while (true) {
$r = socket_recvfrom($sock, $buf, 65535, 0, $remote_ip, $remote_port);
echo "$remote_ip : $remote_port -- " . $buf ."\n";
echo strlen($buf) . "\n";
// DO DATABASE FUNCTIONS
}
Is there a way to flush the buffer after every x amount of iterations as it seems that at a certain point it fills up and the database function doesn't seem to operate anymore until I kill and restart the application?
Data is not critical (that's why I'm using UDP)