ͨ¹ýjavaºÍsnmp»ñÈ¡±¾»úµÄÍø¹ØµØÖ·
±ÏÒµÉè¼ÆÓöµ½Ò»¸öÎÊÌ⣬Èç¹û²ÅÄÜ»ñµÃ±¾»úµÄÍø¹ØµØÖ·£¬ÎÊÁ˰ٶȺÍgoogle£¬ËƺõÕÒ²»µ½´ð°¸£¬ÓÚÊÇÔÚÂÛ̳Àï·¢ÌûÎÊÀÏÄñÃÇ£¬ÔÚËûÃǵÄÌáʾÏ£¬ÊµÏÖÁË»ñÈ¡Íø¹ØµÄµØÖ·£¬ÕâÀïÖ÷ÒªÊÇͨ¹ýsnmpÐÒé¶ÁÈ¡±¾»úµÄmib¿â£¬ÒòΪOIDΪ1.3.6.1.2.1.4.21.1.7¶ÔÓ¦µÄÊÇipRouteNextHop£¬Ò²¾ÍÊÇÏÂÒ»Ìø·ÓÉ£¬¶Ô±¾»úÀ´Ëµ¾Í˵ĬÈÏÍø¹ØÁË£¬ÕâÀïÓõ½ÁËsnmp4jÕâ¸ö°ü£¬ÓÃÓÚʵÏÖsnmpÐÒéµÄÏà¹Ø²Ù×÷£¬Ö®Ç°µÄ²©ÎÄÒ²ÓнéÉÜsnmp4jµÄ¼òµ¥Ê¹Óã¬ÏÂÃæ¾ÍÉÏ´úÂëÁË£º
//ʹÓõ½µÄÀà
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import org.snmp4j.CommunityTarget;
import org.snmp4j.PDU;
import org.snmp4j.Snmp;
import org.snmp4j.TransportMapping;
import org.snmp4j.event.ResponseEvent;
import org.snmp4j.mp.SnmpConstants;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.OID;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.VariableBinding;
import org.snmp4j.transport.DefaultUdpTransportMapping;
//ÏÂÃæÖ»ÊÇÒ»¸ö·½·¨
public String getIpOfGateway(){
String gatewayIpString=null; //Íø¹ØipµØÖ·ÊÇÕâ¸ö×Ö·û´®µÄ×Ó´®
String gatewayIp=null; // ÕâÊÇ´ú±íÍø¹Øip
try {
/**
* Set properties of target
*/
CommunityTarget localhost = new CommunityTarget();
Address address = GenericAddress.parse("udp:127.0.0.1/161");
localhost.setAddress(address);
localhost.setCommunity(new OctetString("public"));
localhost.setRetries(2);
localhost.setTimeout(5*60);
localhost.setVersion(SnmpConstants.version2c);
/**
* Set protocols of UDP and SNMP
*/
TransportMapping transport = new DefaultUdpTransportMapping();
transport.listen();
Snmp protocol = new Snmp(transport);
/**
* OID binding
*/
PDU requestPDU = new PDU();
requestPDU.ad
Ïà¹ØÎĵµ£º
½ñÌ츴ϰÁËÒ»ÏÂÕâЩ֪ʶ£¬Ë³±ã×öÁËϱʼÇ.
1.¼Ä´æÆ÷£º×î¿ìµÄ´æ´¢Çø, ÓɱàÒëÆ÷¸ù¾ÝÐèÇó½øÐзÖÅä,ÎÒÃÇÔÚ³ÌÐòÖÐÎÞ·¨¿ØÖÆ.
2. Õ»£º´æ·Å»ù±¾ÀàÐ͵ıäÁ¿Êý¾ÝºÍ¶ÔÏóµÄÒýÓ㬵«¶ÔÏó±¾Éí²»´æ·ÅÔÚÕ»ÖУ¬¶øÊÇ´æ·ÅÔڶѣ¨new ³öÀ´µÄ¶ÔÏ󣩻òÕß³£Á¿³ØÖУ¨×Ö·û´®³£Á¿¶ÔÏó´æ·ÅÔÚ³£Á¿³ØÖС££©
3. ¶Ñ£º´æ·ÅËùÓÐnew³öÀ´µÄ¶ÔÏó¡£
4. ¾²Ì¬Óò£ ......
1. J2EEÊǹ淶£¬ÊÇÒ»ÖÖJSR±ê×¼£¬ÓÐÏêϸÎĵµ£¬²ûÊöJ2EEÌṩÄÄЩ¹¦ÄÜ£¬¿ÉÒÔÏÂÔØÕâÑùÎĵµ£¬µ±È»»¹ÓÐһЩ´úÂë½Ó¿Ú£¬ÕâÊǵäÐÍJavaÊÀ½çÖеĿò¼Ü´úÂë+±ê×¼ÎĵµÐÎʽ£¬ÕâÊÇÖ»ÓÐ×ÔÓÉÊÀ½ç²ÅÓеĹ淶£¬ÔÚ΢ÈíMSÊÀ½çÄãÊǾø¶Ô²»»á¿´µ½µÄ£¬ËùÒÔ£¬´Ó΢Èíת¹ýÀ´µÄ£¬»áÔΣ¬»á²»ÊÊÓ¦£¬²»ÄÜÔÙ°´ÕÕËûÃÇÒÔÇ°µÄ¾ÑéÀ´¿´´ý×ÔÓɵÄÐÂÊÀ½ç¡£
2.¼Ü¹¹ÊǾ ......
ÃüÃû¹æ·¶
ÏîÄ¿Ãû£º¸÷µ¥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд
°üÃû£ºÈ«²¿×ÖĸСдÇÒΨһ£¬Í¨³£Îª¹«Ë¾ÓòÃûµÄµ¹Ðò
Ô´ÎļþÃû£º¸÷µ¥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд
·½·¨Ãû£ºµÚÒ»¸öµ¥´ÊÈ«²¿Ð¡Ð´£¬ÆäÓ൥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд£¬Ò»°ãӦΪ¶¯´Ê
³ÉÔ±±äÁ¿Ãû£ºµÚÒ»¸öµ¥´ÊÈ«²¿Ð¡Ð´£¬ÆäÓ൥´ÊÊ××Öĸ´óд£¬ÆäËü×ÖĸСд
³ÉÔ±³£Á¿Ãû£ºËùÓе¥ ......
×é¼þ
¹¦ÄÜ
Com.guipei.listener. SessionListener
¼àÌý×é¼þ£¬Íê³ÉHttpSessionContextµÄ¹¦ÄÜ
index.jsp
ʵÏÖÓû§µÇ½£¬´´½¨ÐµÄsession
logout.jsp
ʵÏÖÓû§Í˳ö£¬Óû§×Ô¶¯É¾³ýsession
display.jsp
ÏÔʾÓû§µÇ½ÐÅÏ¢£¬ÔÚÓû§µÇ½ºó×Ô¶¯×ªÈë
session.jsp
Áгöµ±Ç°ËùÓеÄsession
kill.jsp
ɱµôÖ¸¶¨µÄ»á»° ......
ÍøÉÏÓÐÁ˺ܶàÕâÑùµÄÎÄÕ£¬²»¹ý¸Ð¾õ²¢²»ÊǺÜÈ«£¬ÎÒ¶¼¶«ÕÒÎ÷ÕÒ²Å×îÖÕ°ÑJAVAµ÷ÓÃc++¸ø¸ã¶¨¡£
ÏÂÃæÒýÓÃÁ˺ܶàÍøÉÏÒѾÓеĵÄÄÚÈÝ£¬ÎÒÔÚÕâÀïÖ»ÊÇÕûºÏÒ»´Î£¬ÈÃÒÔºóµÄÅóÓÑÉÙ×ßÍø·¡£
¶à˵ÎÞÒ棬¾ßÌåÈçÏ£º
×÷Õß:mykoma
¼ÙÉèËùÓÐÎļþ¶¼·ÅÔÚd:\
Step 1:
дJAVAÎļþ
ÀýÈç³ÌÐòtestdll.java£¬ÄÚÈÝΪ£º
......