 |
linux howto - fabio de lorenzo personal informations and experiences kernel modules and software
|
| View previous topic :: View next topic |
| Author |
Message |
flash_fabio Guest
|
Posted: Fri Apr 29, 2005 3:54 pm Post subject: implementazione di host is Alive, passaggio di funzione |
|
|
isAlive("192.168.150.3","9191",myFun,"gino");
function myFun(res,par) {
trace ("-->par="+par);
trace ("-->res="+res);
}
/*
* isAlive guarda se un host è up e la sua porta in listening
* il risulato è passato alla funzione myFun come primo parametro,
* l'ultimo parametro, viene passato alla funzione myFun
* come secondo parametro
*/
function isAlive(ip,port,templateFunc,parametro ) {
function iaOnConnect(success) {
if (success) templateFunc("HOST raggiunto",parametro);
else templateFunc("HOST irraggiungibile",parametro);
}
socket = new XMLSocket();
socket.onConnect = iaOnConnect;
socket.connect(ip,port);
} |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|