Hi ... I think the best methode to monitor the server is via SNMP. I suggest you to explore the expandable feature of NetSNMP
regards -bino- ----- Original Message ----- From: "Sayang Oin" <[EMAIL PROTECTED]> To: <leaf-user@lists.sourceforge.net> Sent: Wednesday, March 21, 2007 9:34 PM Subject: [leaf-user] connection timeout > Hi, > > I've wrote a programm to check my server status. > It's run on my Bering Box. > the problem is if the server is not online > my checkServer funtion hang very long at the part > /* connect to server */ > my question is is it posiible to change the timeout time? > > thank you very much in advanced > Sayangoin > > > here is the funtion... > > int checkServer(char *hostname) { int port=80; int sd, rc, i; struct sockaddr_in localAddr, servAddr; struct hostent *h; h = gethostbyname(hostname); if(h==NULL) { return 1; } servAddr.sin_family = h->h_addrtype; memcpy((char *) &servAddr.sin_addr.s_addr, h->h_addr_list[0], h->h_length); servAddr.sin_port = htons(port); > /* create socket */ > sd = socket(AF_INET, SOCK_STREAM, 0); if(sd<0) { return 1; } > /* bind any port number */ localAddr.sin_family = AF_INET; localAddr.sin_addr.s_addr = htonl(INADDR_ANY); localAddr.sin_port = htons(0); rc = bind(sd, (struct sockaddr *) &localAddr, sizeof(localAddr)); if(rc<0) { return 1; } > /* connect to server */ rc = connect(sd, (struct sockaddr *) &servAddr, sizeof(servAddr)); if(rc<0) { return 1; } close(sd); return 0; } > > > _________________________________________________________________ > Suchen Sie von einer beliebigen Webseite aus - mit dem perfekten Schutz. Holen Sie sich noch heute die KOSTENLOSE Windows Live Toolbar! > http://toolbar.live.com/ > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ------------------------------------------------------------------------ > leaf-user mailing list: leaf-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/leaf-user > Support Request -- http://leaf-project.org/ > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ------------------------------------------------------------------------ leaf-user mailing list: leaf-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/leaf-user Support Request -- http://leaf-project.org/