IP*Works!

ipworks
Class Snpp

java.lang.Object
  |
  +--ipworks.Snpp

public class Snpp
extends java.lang.Object

The SNPP class is used to send pages through the internet using the SNNP protocol.

It is a client implementation of Simple Network Paging Protocol Version 3 as specified in RFC 1861. Service extensions level 2 are supported intrinsically and the user can access all of level 3 extensions.

SNPP allows, unlike SMTP, for immediate notification of message delivery, gives absolute flexibility over the content sent to the recipient, allows to specifying multiple choice responses, etc.

To send a message the ServerName , recipient's PagerId and Message properties should be filled out (at a minimum) and Action delivers the message.

The server's response is given in PITrail events and by the LastReply property. Customized commands may be sent using the Command property.

Optional properties include: CallerId , ServerPort and LocalHost


Field Summary
static int a_Connect
           
static int a_Disconnect
           
static int a_Idle
           
static int a_Reset
           
static int a_Send
           
 
Constructor Summary
Snpp()
           
 
Method Summary
 void addSnppEventListener(SnppEventListener l)
           
 void fireError(int errorCode, java.lang.String description)
          Information about errors during data delivery.
 void firePITrail(int direction, java.lang.String message)
          Traces the commands sent to the mail server, and the respective replies.
 int getAction()
          An action code for the component.
 java.lang.String getCallerId()
          The id of the caller.
 java.lang.String getLastReply()
          The last reply from the server.
 java.lang.String getLocalHost()
          The name of the local host.
 java.lang.String getMessage()
          The message being sent (alphanumeric).
 java.lang.String getPagerId()
          The id number of the pager sending a Message to.
 java.lang.String getServerName()
          The name or address of the SNPP server.
 int getServerPort()
          The server port for SNPP (default 444).
 void removeSnppEventListener(SnppEventListener l)
           
 void setAction(int action)
          An action code for the component.
 void setCallerId(java.lang.String callerId)
          The id of the caller.
 void setCommand(java.lang.String command)
          Can be used to send additional commands directly to the SNPP server.
 void setMessage(java.lang.String message)
          The message being sent (alphanumeric).
 void setPagerId(java.lang.String pagerId)
          The id number of the pager sending a Message to.
 void setServerName(java.lang.String serverName)
          The name or address of the SNPP server.
 void setServerPort(int serverPort)
          The server port for SNPP (default 444).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

a_Idle

public static final int a_Idle

a_Connect

public static final int a_Connect

a_Disconnect

public static final int a_Disconnect

a_Send

public static final int a_Send

a_Reset

public static final int a_Reset
Constructor Detail

Snpp

public Snpp()
Method Detail

getAction

public int getAction()
An action code for the component. Setting the Action property to a valid action code makes the class perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

The following are the possible values for the Action property and the corresponding descriptions:

a_Idle
Default action. It can also be used to interrupt the current operation.
a_Connect
Connects to the SNPP server. Any number of messages can later be sent using the 'Send Message' action below.
a_Disconnect
Disconnects from the SNPP gateway.
a_Send
If the class is not connected to the SNPP server, a connection is created. Then the class attempts to deliver the current message.
a_Reset
Resets the server state created during the connection, so that a new message may be sent to the gateway using the already established connection.


setAction

public void setAction(int action)
               throws IPWorksException
An action code for the component. Setting the Action property to a valid action code makes the class perform the associated action. If the action completes successfully, execution continues normally, and Action is reset to 0 (Idle). If an error happens, then an IPWorksException exception is raised.

The following are the possible values for the Action property and the corresponding descriptions:

a_Idle
Default action. It can also be used to interrupt the current operation.
a_Connect
Connects to the SNPP server. Any number of messages can later be sent using the 'Send Message' action below.
a_Disconnect
Disconnects from the SNPP gateway.
a_Send
If the class is not connected to the SNPP server, a connection is created. Then the class attempts to deliver the current message.
a_Reset
Resets the server state created during the connection, so that a new message may be sent to the gateway using the already established connection.


getCallerId

public java.lang.String getCallerId()
The id of the caller. This may also provide authentication to the SNPP server and may include other authentication information as requested by the server you are connecting to.


setCallerId

public void setCallerId(java.lang.String callerId)
                 throws IPWorksException
The id of the caller. This may also provide authentication to the SNPP server and may include other authentication information as requested by the server you are connecting to.


setCommand

public void setCommand(java.lang.String command)
                throws IPWorksException
Can be used to send additional commands directly to the SNPP server. Check the LastReply property and/or trap the PITrail events comming from the server to get the response.


getLastReply

public java.lang.String getLastReply()
The last reply from the server. This is the last reply received from the server. It can be used for information purposes. The same information may also be retrieved through the PITrail event.


getMessage

public java.lang.String getMessage()
The message being sent (alphanumeric). The message can be a single a line or split over multiple lines depending on what the restrictions of the receiving device and gateway. Normally messages are no longer than 100 characters long.


setMessage

public void setMessage(java.lang.String message)
                throws IPWorksException
The message being sent (alphanumeric). The message can be a single a line or split over multiple lines depending on what the restrictions of the receiving device and gateway. Normally messages are no longer than 100 characters long.


getPagerId

public java.lang.String getPagerId()
The id number of the pager sending a Message to. Additional information such as a password or a PIN may be appended to the PagerId depending upon server requirements.


setPagerId

public void setPagerId(java.lang.String pagerId)
                throws IPWorksException
The id number of the pager sending a Message to. Additional information such as a password or a PIN may be appended to the PagerId depending upon server requirements.


getServerName

public java.lang.String getServerName()
The name or address of the SNPP server. The ServerName property specifies the IP address (IP number in dotted internet format) or Domain Name of the SNPP server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the ServerName property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the ServerName property is set to the corresponding address. If the search is not successful, an error is returned.


setServerName

public void setServerName(java.lang.String serverName)
                   throws IPWorksException
The name or address of the SNPP server. The ServerName property specifies the IP address (IP number in dotted internet format) or Domain Name of the SNPP server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the ServerName property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the ServerName property is set to the corresponding address. If the search is not successful, an error is returned.


getServerPort

public int getServerPort()
The server port for SNPP (default 444). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the ServerPort while connected will fail with an error.


setServerPort

public void setServerPort(int serverPort)
                   throws IPWorksException
The server port for SNPP (default 444). A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed while a connection is in progress. Any attempt to change the ServerPort while connected will fail with an error.


getLocalHost

public java.lang.String getLocalHost()
The name of the local host. When connected, the IP address of the interface through which the connection was made. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call.

If the class is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).


fireError

public void fireError(int errorCode,
                      java.lang.String description)
Information about errors during data delivery. (Called internally to dispatch the event.)
See Also:
SnppErrorEvent

firePITrail

public void firePITrail(int direction,
                        java.lang.String message)
Traces the commands sent to the mail server, and the respective replies. (Called internally to dispatch the event.)
See Also:
SnppPITrailEvent

addSnppEventListener

public void addSnppEventListener(SnppEventListener l)
                          throws java.util.TooManyListenersException

removeSnppEventListener

public void removeSnppEventListener(SnppEventListener l)

IP*Works!

Copyright (c) 1995-2000 by /n software inc. - All rights reserved.