Hi,
I haven't tried this yet but I'm sure someone has.... :)
Using the metacard 'accept on port' command..
1. Will this cause the server app to listen on all available interfaces?
2. How do you restrict metacard listening to just one interface?
regards alex
_______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Hi Alex,
The answer is no.
Because each different MC app is only able to listen at one port (aka one socket listener : a php or cgi script), at one time, you have just to name the port you want have each app to listen to, just alike below :
on newconnect s # reading the request from a new socket read from socket s for 1 line with message "serverread" end newconnect
on serverread x,y # processing the request
global PostIn,Retour,Debut,Lepath,Ppa
put urldecode(y) into PostIn # donn�es POST re�ues de wmc.xml
put cr into char (length(PostIn))-1 to (length(PostIn)) of PostIn
put "" into Retour
set itemdelimiter to "&"
doswitcher # the code the server app have to run goes here
write Retour to socket x
close socket x # x = adresse IP & "|" & n� d'ordre du socket fils re�u de wmc.xml
repeat
if the num of lines in (opensockets()) > 1 then close socket line 2 of
(opensockets()) else exit repeat
end repeat
end serverread
on preOpenStack ... set the socketTimeoutInterval to "10" # to set up to lots more on client-side MC Jaguar-hosted apps if the windows is "WMCPE" (if the server app is running in console-mode in the background) then accept connections on port "765" with message "newconnect" else accept connections on port "7654" with message "newconnect" ... end preOpenStack
It's in setting up the sockets listener script that you will choose the active interface, one at each time you want to listen to. See the php example below, witch is able to bind, Apache to the MC application server, in both console (on root protected port 765) and graphical (on port 7654) modes :
<?
if ($REQUEST_METHOD == POST) {
$headers = $HTTP_POST_VARS; while (list($header, $value) = each($headers)) $exAE .= "$header=$value&"; $exAE = urlencode($exAE); $activapp = substr($exAE,0,5); if ($activapp == "ia832") {
$connection = fsockopen("localhost", "765", &$error_number, &$error_description, "30"); if ($connection) {
set_socket_blocking($connection, true);
fputs($connection,"");
fputs($connection,"$exAE"."\r\n");
fpassthru($connection);
}
else {
$connection = fsockopen("localhost", "7654", &$error_number, &$error_description, "30"); if ($connection) {
set_socket_blocking($connection, true);
fputs($connection,"");
fputs($connection,"$exAE"."\r\n");
fpassthru($connection);
}
else print("erreur num�ro $error_number ($error_description)<BR>\n");
}
}
}
?>
-- Bien cordialement, Pierre Sahores
Inspection acad�mique de Seine-Saint-Denis Serveurs d'applications et SGBDR (Web/PGI) Penser et produire l'avantage comp�titif
_______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
