📄 netsnmpsession.html
字号:
<BR> Opens the session given the current set of properties</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#read(double)">read</A></B>(double timeout)</CODE><BR> <B>Deprecated.</B> <I>operation has been moved to an internal thread. Further use is now an error</I></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#send(org.netsnmp.PDU, java.lang.Object)">send</A></B>(<A HREF="../../org/netsnmp/PDU.html">PDU</A> thePdu, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A> o)</CODE><BR> Sends the pdu to the peer</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setAuthenticationProtocol(org.netsnmp.OID)">setAuthenticationProtocol</A></B>(<A HREF="../../org/netsnmp/OID.html">OID</A> oid)</CODE><BR> Setter for authentication protocol corresponds to the -a option for snmpcmd(1)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setAuthPassword(java.lang.String)">setAuthPassword</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> string)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setCommunity(java.lang.String)">setCommunity</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> string)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setContextEngineID(byte[])">setContextEngineID</A></B>(byte[] bs)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setContextName(java.lang.String)">setContextName</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> string)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../org/netsnmp/NetSNMPSession.serialEncryption.html">NetSNMPSession.serialEncryption</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setDefaultEncryptor(org.netsnmp.NetSNMPSession.serialEncryption)">setDefaultEncryptor</A></B>(<A HREF="../../org/netsnmp/NetSNMPSession.serialEncryption.html">NetSNMPSession.serialEncryption</A> cryptor)</CODE><BR> Set a new default encryptor</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setPeerName(java.lang.String)">setPeerName</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> hostname)</CODE><BR> Format of the hostname can be as follows:<br> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setPrivacyProtocol(org.netsnmp.OID)">setPrivacyProtocol</A></B>(<A HREF="../../org/netsnmp/OID.html">OID</A> oid)</CODE><BR> Setter for privacy protocol corresponds to the -x DES option for snmpcmd(1)</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setPrivPassword(java.lang.String)">setPrivPassword</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> string)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setRcvMsgMaxSize(long)">setRcvMsgMaxSize</A></B>(long l)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setRetries(int)">setRetries</A></B>(int i)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityAuthKey(byte[])">setSecurityAuthKey</A></B>(byte[] bs)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityAuthOID(org.netsnmp.OID)">setSecurityAuthOID</A></B>(<A HREF="../../org/netsnmp/OID.html">OID</A> oid)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityEngineID(byte[])">setSecurityEngineID</A></B>(byte[] bs)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityLevel(org.netsnmp.SecurityLevel)">setSecurityLevel</A></B>(<A HREF="../../org/netsnmp/SecurityLevel.html">SecurityLevel</A> level)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityModel(int)">setSecurityModel</A></B>(int i)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityName(java.lang.String)">setSecurityName</A></B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> string)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityPrivKey(byte[])">setSecurityPrivKey</A></B>(byte[] key)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSecurityPrivOID(org.netsnmp.OID)">setSecurityPrivOID</A></B>(<A HREF="../../org/netsnmp/OID.html">OID</A> oid)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSerialEncryptor(org.netsnmp.NetSNMPSession.serialEncryption)">setSerialEncryptor</A></B>(<A HREF="../../org/netsnmp/NetSNMPSession.serialEncryption.html">NetSNMPSession.serialEncryption</A> encryption)</CODE><BR> Sets the encryption object to use to encrypt/decrypt v1/v2 community names and v3 auth/priv passwords during serialization/deserialization</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSndMsgMaxSize(long)">setSndMsgMaxSize</A></B>(long size)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setSNMPVersion(org.netsnmp.SNMPVersion)">setSNMPVersion</A></B>(<A HREF="../../org/netsnmp/SNMPVersion.html">SNMPVersion</A> version)</CODE><BR> </TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../org/netsnmp/NetSNMPSession.html#setTimeout(long)">setTimeout</A></B>(long t)</CODE><BR> </TD></TR></TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#clone()">clone</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#getClass()">getClass</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notify()">notify</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#toString()">toString</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait()">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long)">wait</A>, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE> <P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="NetSNMPSession()"><!-- --></A><H3>NetSNMPSession</H3><PRE>public <B>NetSNMPSession</B>()</PRE><DL><DD>Creates a new instance of Session<P></DL><HR><A NAME="NetSNMPSession(java.lang.String, java.lang.String)"><!-- --></A><H3>NetSNMPSession</H3><PRE>public <B>NetSNMPSession</B>(<A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> peerName, <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> community) throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/IllegalStateException.html">IllegalStateException</A></PRE><DL><DD>Creates and opens an SNMPv2c session to a remote host<P><DT><B>Parameters:</B><DD><CODE>peerName</CODE> - host name of the remote agent, may be in any format acceptable to net-snmp utilties. Typically in the format of<br><br> <center>transport:hostname:portNumber</center><br> <center>hostname:portNumber <i>(defaults to UDP transport)</i></center><br> <center>hostname <i>(defaults to UDP transport and port 161)</i></center><br><DD><CODE>community</CODE> - community of the remote agent</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="addListener(org.netsnmp.NetSNMPAction)"><!-- --></A><H3>addListener</H3><PRE>public void <B>addListener</B>(<A HREF="../../org/netsnmp/NetSNMPAction.html">NetSNMPAction</A> listener)</PRE><DL><DD>Adds a listener that responds to PDUs from the remote agents. When a pdu is received by this session the <A HREF="../../org/netsnmp/NetSNMPAction.html#actionPerformed(int, org.netsnmp.NetSNMPSession, org.netsnmp.PDU, java.lang.Object)"><CODE>NetSNMPAction.actionPerformed(int, org.netsnmp.NetSNMPSession, org.netsnmp.PDU, java.lang.Object)</CODE></A> method is called<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>listener</CODE> - object that implements the <A HREF="../../org/netsnmp/NetSNMPAction.html#actionPerformed(int, org.netsnmp.NetSNMPSession, org.netsnmp.PDU, java.lang.Object)"><CODE>NetSNMPAction.actionPerformed(int, org.netsnmp.NetSNMPSession, org.netsnmp.PDU, java.lang.Object)</CODE></A> method to process the information returned from the agent</DL></DD></DL><HR><A NAME="deleteListener(org.netsnmp.NetSNMPAction)"><!-- --></A><H3>deleteListener</H3><PRE>public <A HREF="../../org/netsnmp/NetSNMPAction.html">NetSNMPAction</A> <B>deleteListener</B>(<A HREF="../../org/netsnmp/NetSNMPAction.html">NetSNMPAction</A> listener)</PRE><DL><DD>Delete the listenen from the list of listeners.<P><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>listener</CODE> - listener to be deleted<DT><B>Returns:</B><DD>the listener deleted, null if not found. If not found listener list remains unchanged.</DL></DD></DL><HR><A NAME="finalize()"><!-- --></A><H3>finalize</H3><PRE>protected void <B>finalize</B>() throws <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Throwable.html">Throwable</A></PRE><DL><DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html#finalize()">finalize</A></CODE> in class <CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DD><CODE><A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/Throwable.html">Throwable</A></CODE></DL></DD></DL><HR><A NAME="getAuthPassword()"><!-- --></A><H3>getAuthPassword</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> <B>getAuthPassword</B>()</PRE><DL><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the authentication password in use</DL></DD></DL><HR><A NAME="getCommunity()"><!-- --></A><H3>getCommunity</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> <B>getCommunity</B>()</PRE><DL><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the community</DL></DD></DL><HR><A NAME="getContextEngineID()"><!-- --></A><H3>getContextEngineID</H3><PRE>public byte[] <B>getContextEngineID</B>()</PRE><DL><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the context engine ID</DL></DD></DL><HR><A NAME="getContextName()"><!-- --></A><H3>getContextName</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> <B>getContextName</B>()</PRE><DL><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>context name in use</DL></DD></DL><HR><A NAME="getPeerName()"><!-- --></A><H3>getPeerName</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> <B>getPeerName</B>()</PRE><DL><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the peer name. This is the name of the remote agent</DL></DD></DL><HR><A NAME="getPrivPassword()"><!-- --></A><H3>getPrivPassword</H3><PRE>public <A HREF="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html">String</A> <B>getPrivPassword</B>()</PRE><DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -