EDIT: I can put the question in a shorter way that perhaps focuses more closely on the real problem:
Is there a way to keep PHP Sockets alive over multiple pages? That is, can I store the connection (the socket object) in any way?
I want to save a socket connection between two PHP pages where the other page is loaded via jQuery ajax. I tried it with sessions and so far got this on my main page:
$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$res = socket_connect($sock, $host, $port);
session_start();
$_SESSION['sock'] = $sock;
I then load a page with jQuery:
$("#" + in_name + "_holder").load("set_setpoint.php", {name:in_name, value:in_value});
And in set_setpoints.php:
session_start();
require_once("sock_funcs.php");
echo $_SESSION['sock'];
I only get '0', but what I should get is something like "Resource id #xxx". Maybe sessions is the wrong way?