X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Fauthd%2Fauthd.php;h=6156a5e08c751e5270b1043b26880e7a69add9eb;hp=f5e35e9c342e10342e3854ac3d87f35f49f59332;hb=f10680a1827dd8e4c65eaaef810ee7fd498e5a1e;hpb=8288d3ccabef50ae2d75fe48cdd60c57d264cbe1 diff --git a/authserver/authd/authd.php b/authserver/authd/authd.php index f5e35e9..6156a5e 100644 --- a/authserver/authd/authd.php +++ b/authserver/authd/authd.php @@ -11,6 +11,7 @@ require_once("../lib/lib.php"); // first we want to fork into the background like all good daemons should //$pid = pcntl_fork(); + // uncomment this bit and comment the fork above to stop it going into the background $pid = 0; @@ -29,17 +30,21 @@ if($pid == -1) { // 3) main server continues. // a forked process thingy should be fully self contained and capable of dealing // with "problems", i.e. the parent doesnt want to have to clean up children + + /* TCP TEST global $MSG_QUEUE_KEY_ID_SERVER, $MSG_QUEUE_KEY_ID_CLIENT; - global $TCP_PORT_NUMBER; + $cl_queue = msg_get_queue($MSG_QUEUE_KEY_ID_CLIENT, 0666 | 'IPC_CREAT'); $sr_queue = msg_get_queue($MSG_QUEUE_KEY_ID_SERVER, 0666 | 'IPC_CREAT'); + */ // Here goes the tcp equivalent - /* + global $TCP_PORT_NUMBER; $res = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); - socket_bind($res, "127.0.0.1", 10056); + socket_bind($res, "127.0.0.1", $TCP_PORT_NUMBER); socket_listen($res); + echo "am now listneing\n"; while(true) { $data_socket = socket_accept($res); @@ -57,7 +62,7 @@ if($pid == -1) { while($continue) { $size = socket_recv($data_socket, $recvd_a, 1024, 0); $recvd .= $recvd_a; - if(preg_match("/.*\:EOD$/", $recvd) { + if(preg_match("/.*\:EOD$/", $recvd)) { // we have a full string... break out $continue = false; break; @@ -71,6 +76,10 @@ if($pid == -1) { $msg_type = $component["type"]; $msg = $component["data"]; + echo "I now have a message of $msg_type\n"; + echo "with data:\n"; + print_r($msg); + echo "eof\n"; // the switch should now set a $data_returned value that gets bundled up and sent back to the client // HERES WHERE THE SWITCH GOES // ****** @@ -474,8 +483,8 @@ if($pid == -1) { } // otherwise return to the accept loop } - - */ +} + /* $myga = new gaasGA(); global $myga; @@ -869,7 +878,10 @@ if($pid == -1) { break; } + } + } +*/ ?>