I get the info to fill checkboxes/textboxes from an included php script. The user is then able to change those values (ie: check/uncheck) then click a submit button. That button posts the data to a new page which tells the user to wait for a moment. What that page is doing is reading all the post data and then using a socket to connect to a remote UDP server to send all the commands and new values.
What I'm trying to figure out how to do is send all that data to the UDP server without having to open/close a connection for each command. And if there is a way to know which values specifically were changed then I could updated those instead of sending the entire list of items to the server.
I have a code sample that you can see that will show what I am trying to do. I've only used a few commands for this one and all the info here is bogus, but it will let you see where I'm headed right now.
session_start();
$server = $_SESSION["server"];
$port = $_SESSION["port"];
$pass = $_SESSION["password"];
if(!$server || !$port || !$pass) {
echo "INVALID OPERATION";
exit();
}
$cmd1 = "w_1 " . $_POST["xa"];
$cmd2 = "w_2 " . $_POST["xb"];
$cmd3 = "w_3 " . $_POST["xc"];
$cmd4 = "w_4 " . $_POST["xd"];
$cmd5 = "w_5 " . $_POST["xe"];
$cmd6 = "w_6 " . $_POST["xf"];
$cmd7 = "w_7 " . $_POST["xg"];
$cmd8 = "w_8 " . $_POST["xh"];
$cmd9 = "w_9 " . $_POST["xi"];
$cmd10 = "w_10 " . $_POST["xj"];
$cmd11 = "w_11 " . $_POST["xk"];
$cmd12 = "w_12 " . $_POST["xl"];
killRoy($server, $port, $pass, $cmd1);
killRoy($server, $port, $pass, $cmd2);
killRoy($server, $port, $pass, $cmd3);
killRoy($server, $port, $pass, $cmd4);
killRoy($server, $port, $pass, $cmd5);
killRoy($server, $port, $pass, $cmd6);
killRoy($server, $port, $pass, $cmd7);
killRoy($server, $port, $pass, $cmd8);
killRoy($server, $port, $pass, $cmd9);
killRoy($server, $port, $pass, $cmd10);
killRoy($server, $port, $pass, $cmd11);
killRoy($server, $port, $pass, $cmd12);
function killRoy($serverx, $portx, $passx, $command) {
$xCon = fsockopen('udp://'.$serverx, $portx);
fwrite($xCon, '\\cnx ' . $passx . ' ' . $command);
fclose($xCon);
}