All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Snmp.SASClient

java.lang.Object
   |
   +----Snmp.SASClient

public class SASClient
extends Object
The SASClient class is needed on account of browser security which prevents Java applets from sending data to any host but the applet host when loaded over the network.

We do not recommend directly using this class, except for the saveFile method or appendFile method to save data on the applet host.

This class implements a client to send/receive PDUs from any SNMP peer via a deamon (SAS) on the Applet Host, i.e. Web server. Your applet needs to instantiate this class to communicate with an SNMP entity using Java enabled browsers that do not permit socket connections to anything but the applet host.

Use the open method on your session instance to specify whether this class needs to be instantiated.. For each session, you will call the open method with the applet as an argument. If you don't supply the applet argument, or the connection to the SAS daemon fails, the session will try and open a local port.

See Also:
SnmpSession

Variable Index

 o connected
Indicates if the connection to the SNMP Applet Server has been successfully established.

Constructor Index

 o SASClient(Applet, boolean)
By Default this constructor will look for the SASocketPort file in the applet html directory.

Method Index

 o appendFile(String, byte[])
The appendFile method for appending data to a file in "users" sub-directory of the applet code base directory on the applet host.
 o clientCall(byte[])
 o close()
Close the remote session
 o createDir(String)
The createDir method for deleting a directory on the applet host.
 o deleteDir(String)
The deleteDir method for deleting a directory on the applet host.
 o deleteFile(String)
The deleteFile method for deleting a file on the applet host.
 o receive()
Used to pick up PDUs from the remote port on the SAS server Blocks until a PDU has been received
 o saveFile(String, byte[])
The saveFile method for saving data to a file in "users" sub-directory of the applet code base directory on the applet host.
 o send(String, int, byte[])
The send method for sending PDUs

Variables

 o connected
 public boolean connected
Indicates if the connection to the SNMP Applet Server has been successfully established.

Constructors

 o SASClient
 public SASClient(Applet applet,
                  boolean debug) throws SnmpException
By Default this constructor will look for the SASocketPort file in the applet html directory. If the SASocketPort file is created elsewhere then the direcory where it is created is specified in the applet html file using an applet parameter SAS_PORT_DIR.

Throws: SnmpException
is thrown upon error.

Methods

 o send
 public void send(String hostname,
                  int port,
                  byte data[]) throws IOException
The send method for sending PDUs

 o saveFile
 public void saveFile(String filename,
                      byte data[]) throws IOException
The saveFile method for saving data to a file in "users" sub-directory of the applet code base directory on the applet host. Lacks error checking at this point.

 o appendFile
 public void appendFile(String filename,
                        byte data[]) throws IOException
The appendFile method for appending data to a file in "users" sub-directory of the applet code base directory on the applet host. Lacks error checking at this point.

 o receive
 public void receive() throws SnmpException, IOException
Used to pick up PDUs from the remote port on the SAS server Blocks until a PDU has been received

Throws: SnmpException
is thrown on receive errors.
Throws: IOException
is thrown on receive errors.
 o close
 public void close()
Close the remote session

 o clientCall
 public synchronized byte[] clientCall(byte bytes[])
 o createDir
 public void createDir(String directory) throws IOException
The createDir method for deleting a directory on the applet host. Can specify a relative path to SASusers sub-dir of applet directory.

 o deleteFile
 public void deleteFile(String filename) throws IOException
The deleteFile method for deleting a file on the applet host.

 o deleteDir
 public void deleteDir(String directory) throws IOException
The deleteDir method for deleting a directory on the applet host. Will not delete a directory that is not empty.


All Packages  Class Hierarchy  This Package  Previous  Next  Index