Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.co.westhawk.snmp.net
Class NetscapeSocket

    java.lang.Object
      |
      +--uk.co.westhawk.snmp.net.NetscapeSocket

All Implemented Interfaces:
  ContextSocketFace

public class NetscapeSocket
extends java.lang.Object
implements ContextSocketFace

Use this Socket when running the stack as an applet in Netscape.

This is a wrapper class around the DatagramSocket with handles to the Netscape capabilities classes.

See Introduction to the capabilities classes and package netscape.security.

Version:
  $Revision: 1.13 $ $Date: 2006/01/30 15:50:38 $
Author:
  Tim Panton
See Also:
  `DatagramSocket`

Field Summary
`static java.lang.String` | `UNIVERSAL_CONNECT`
`static java.lang.String` | `UNIVERSAL_LISTEN`

Fields inherited from interface uk.co.westhawk.snmp.net.ContextSocketFace
`version_id`

Constructor Summary
`NetscapeSocket()`

Method Summary
`void` | `close()` Closes this socket.
`void` | `create(int port, java.lang.String bindAddr)` Creates the socket.
`void` | `create(java.lang.String host, int port, java.lang.String bindAddr)` Creates the socket.
`java.lang.String` | `getLocalSocketAddress()` Returns the address of the endpoint this socket is bound to, or null if it is not bound yet.
`java.lang.String` | `getReceivedFromHostAddress()` Returns the IP address of the (latest) host of the packet we received.
`java.lang.String` | `getRemoteSocketAddress()` Returns the address of the endpoint this socket is connected to, or null if it is unconnected.
`java.lang.String` | `getSendToHostAddress()` Returns the IP address of the host we sent the packet to.
`StreamPortItem` | `receive(int maxRecvSize)` Receives a packet from this socket.
`void` | `send(byte[] packet)` Sends a packet from this socket.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UNIVERSAL_LISTEN

    public static final java.lang.String UNIVERSAL_LISTEN

See Also:
  Constant Field Values

### UNIVERSAL_CONNECT

    public static final java.lang.String UNIVERSAL_CONNECT

See Also:
  Constant Field Values

Constructor Detail

### NetscapeSocket

    public NetscapeSocket()

Method Detail

### create

    public void create(int port,
                       java.lang.String bindAddr)
                throws java.io.IOException

  Description copied from interface: `ContextSocketFace`
  Creates the socket. This socket is used when listening for incoming requests or traps. Use only one (1) of the two create methods.

  Specified by:
    `create` in interface `ContextSocketFace`
  Parameters:
    `port` - The local port number were we receive (listen for) packets
    `bindAddr` - The local address the server will bind to when listening
    `java.io.IOException`
  See Also:
    `ContextSocketFace.create(String, int, String)`

### create

    public void create(java.lang.String host,
                       int port,
                       java.lang.String bindAddr)
                throws java.io.IOException

  Description copied from interface: `ContextSocketFace`
  Creates the socket. This socket is used to send out our requests. Use only one (1) of the two create methods.

  Specified by:
    `create` in interface `ContextSocketFace`
  Parameters:
    `host` - The name of the host that is to receive our packets
    `port` - The port number of the host
    `bindAddr` - The local address the server will bind to when sending packets
    `java.io.IOException`
  See Also:
    `ContextSocketFace.create(int, String)`

### getReceivedFromHostAddress

    public java.lang.String getReceivedFromHostAddress()

  Description copied from interface: `ContextSocketFace`
  Returns the IP address of the (latest) host of the packet we received. Only applicable when anything has been received. When sending a request, this will in most cases be the same host where we sent the original packet to.

  Specified by:
    `getReceivedFromHostAddress` in interface `ContextSocketFace`
  Returns:
    The IP address, or null when the hostname cannot be determined
  See Also:
    `ContextSocketFace.getSendToHostAddress()`

### getSendToHostAddress

    public java.lang.String getSendToHostAddress()

  Description copied from interface: `ContextSocketFace`
  Returns the IP address of the host we sent the packet to. Only applicable when sending requests, not when (only) listening for incoming requests or traps.

  Specified by:
    `getSendToHostAddress` in interface `ContextSocketFace`
  Returns:
    The IP address, or null when the hostname cannot be determined
  See Also:
    `ContextSocketFace.getReceivedFromHostAddress()`

### getLocalSocketAddress

    public java.lang.String getLocalSocketAddress()

  Description copied from interface: `ContextSocketFace`
  Returns the address of the endpoint this socket is bound to, or null if it is not bound yet.

  Specified by:
    `getLocalSocketAddress` in interface `ContextSocketFace`

### getRemoteSocketAddress

    public java.lang.String getRemoteSocketAddress()

  Description copied from interface: `ContextSocketFace`
  Returns the address of the endpoint this socket is connected to, or null if it is unconnected.

  Specified by:
    `getRemoteSocketAddress` in interface `ContextSocketFace`

### receive

    public StreamPortItem receive(int maxRecvSize)
                           throws java.io.IOException

  Description copied from interface: `ContextSocketFace`
  Receives a packet from this socket. The StreamPortItem object contains the host and port the packet came from.

  Specified by:
    `receive` in interface `ContextSocketFace`
  Parameters:
    `maxRecvSize` - the maximum number of bytes to receive
  Returns:
    the packet
    `java.io.IOException`

### send

    public void send(byte[] packet)
              throws java.io.IOException

  Description copied from interface: `ContextSocketFace`
  Sends a packet from this socket. It can throw an "java.io.IOException: Invalid argument" when the bind address is incorrect for some reason.

  Specified by:
    `send` in interface `ContextSocketFace`
  Parameters:
    `packet` - the packet
    `java.io.IOException`

### close

    public void close()

  Description copied from interface: `ContextSocketFace`
  Closes this socket.

  Specified by:
    `close` in interface `ContextSocketFace`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SNMP Stack 5_1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD