Howdy! WOW...I was really surprised at the number of responses that I got. I didn't realize there were that many of you that were looking for something like this.
Our web developer did most of the coding, so I guess the kudos go to him. His name is Tim Hatch (Web Admin,UNT - College of Business Administration, Computing Center). I think he added header rems to the sections he modified. Pick any number of your vnc servers that you want to be in the "server pool". Add their names or IPs in the $hosts array at the top of the vncfinder text file (This is actually a .php file renamed). Then copy the php to your web server. Hit this page from the client to get an open server. The only piece that isn't here, is you have to create a mime type on the "client machines" to open the configuration file with vncviewer.exe. If you have questions, or suggestions, let me know! --Chris >>> "Alex K. Angelopoulos" <[EMAIL PROTECTED]> 05/25/02 01:26PM >>> Chris, I would be very interested in seeing what you came up with. I don't know for sure that I can "add value" with it since I am only marginally competent with PHP, but this is a neat idea. Also, would you have any objections to me posting a credited copy of the source on my VNC Tools page? The current page I keep up is at: http://www.bittnet.com/winremote/vnc_tools.htm
<?;
$hosts = array("VncSvr1", "VncSvr2","VncSvr3","VncSvr4","VncSvr5", etc... );
$myServer = findGoodList($hosts);
if ($myServer=='') {
echo "Sorry, all servers are busy. Please press Back to try again.";
} else { #One is chosen
$theFile = "[connection]\r
host=$myServer\r
port=5900\r
password=\r
[options]\r
use_encoding_0=1\r
use_encoding_1=1\r
use_encoding_2=1\r
use_encoding_3=1\r
use_encoding_4=1\r
use_encoding_5=1\r
preferred_encoding=5\r
restricted=0\r
viewonly=0\r
fullscreen=0\r
8bit=0\r
shared=0\r
swapmouse=0\r
belldeiconify=0\r
emulate3=1\r
emulate3timeout=100\r
emulate3fuzz=4\r
disableclipboard=0\r
localcursor=1\r
scale_num=1\r
scale_den=1\r
";
header("Content-Type: application/vnc");
header("Content-Length: " . strlen($theFile));
header('Content-Disposition: inline; filename=class.vnc');
echo $theFile;
}
function findGoodList($serverList) {
while (list($key, $val) = each($serverList)) {
#Open socket to host on port 5800
$fp = fsockopen ($val, 5800, $errno, $errstr, 3); #last number is timeout
if (!$fp) {
#echo "Socket Error connecting to $val : $errstr ($errno)<br>\n";
} else {
$state="";
fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
while (!feof($fp)) {
$state .= fgets($fp,128);
}
fclose ($fp);
#Now parse the data for either a 200 ok or something else
$statcode = substr($state,9,3);
if ($statcode=="200") {
#200 OK
#This server is okay so add it to the list
$good++;
$goodServers[$good] = $val;
} else {
#Something else
#echo "Server $val busy...<BR>\r\n";
}
}
}
if ($good==0) { return ''; }
if ($good==1) {return $goodServers[1]; }
#Now choose one good server randomly
mt_srand(make_seed());
$randval = mt_rand(1,$good);
return $goodServers[$randval];
}
// seed with microseconds
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
vncHTTPConnect.cpp
Description: Binary data
