IP*Works!

ipworks
Class Snpp

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

public class Snpp
extends java.lang.Object

The SNPP control 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 calling the Send method or setting the 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 fwNone
           
static int fwSOCKS4
           
static int fwSOCKS5
           
static int fwTunnel
           
static int snppConnect
           
static int snppDisconnect
           
static int snppIdle
           
static int snppReset
           
static int snppSend
           
 
Constructor Summary
Snpp()
           
 
Method Summary
 void addSnppEventListener(SnppEventListener l)
           
 void connect()
          Connect to an SNPP serer.
 void disconnect()
          Disconnect from an SNPP gateway.
 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 server, and the respective replies.
 int getAction()
          An action code for the component.
 java.lang.String getCallerId()
          The id of the caller.
 byte[] getFirewallData()
          Used to send other data to firewall.
 java.lang.String getFirewallHost()
          Name or IP address of firewall (optional).
 java.lang.String getFirewallPassword()
          A password if authentication is to be used connecting through the firewall.
 int getFirewallPort()
          Port of the firewall to connect to.
 int getFirewallType()
          Determines the type of firewall to connect through.
 java.lang.String getFirewallUser()
          A user name if authentication is to be used connecting through a firewall.
 java.lang.String getLastReply()
          The last reply from the server.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 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).
 int getTimeout()
          A timeout for the component.
 boolean isConnected()
          Shows whether the component is connected.
 void removeSnppEventListener(SnppEventListener l)
           
 void reset()
          Resets the server state created during the connection.
 void send()
          Send the current message.
 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 setFirewallData(byte[] firewallData)
          Used to send other data to firewall.
 void setFirewallHost(java.lang.String firewallHost)
          Name or IP address of firewall (optional).
 void setFirewallPassword(java.lang.String firewallPassword)
          A password if authentication is to be used connecting through the firewall.
 void setFirewallPort(int firewallPort)
          Port of the firewall to connect to.
 void setFirewallType(int firewallType)
          Determines the type of firewall to connect through.
 void setFirewallUser(java.lang.String firewallUser)
          A user name if authentication is to be used connecting through a firewall.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 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).
 void setTimeout(int timeout)
          A timeout for the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

snppIdle

public static final int snppIdle

snppConnect

public static final int snppConnect

snppDisconnect

public static final int snppDisconnect

snppSend

public static final int snppSend

snppReset

public static final int snppReset

fwNone

public static final int fwNone

fwTunnel

public static final int fwTunnel

fwSOCKS4

public static final int fwSOCKS4

fwSOCKS5

public static final int fwSOCKS5
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 control 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:

snppIdle (0)
Default action. It can also be used to interrupt the current operation.
snppConnect (1)
Connects to the SNPP server. Any number of messages can later be sent using the snppSendMessage action below.
snppDisconnect (2)
Disconnects from the SNPP gateway.
snppSend (3)
If the control is not connected to the SNPP server, a connection is created. Then the control attempts to deliver the current message.
snppReset (4)
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 control 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:

snppIdle (0)
Default action. It can also be used to interrupt the current operation.
snppConnect (1)
Connects to the SNPP server. Any number of messages can later be sent using the snppSendMessage action below.
snppDisconnect (2)
Disconnects from the SNPP gateway.
snppSend (3)
If the control is not connected to the SNPP server, a connection is created. Then the control attempts to deliver the current message.
snppReset (4)
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.


isConnected

public boolean isConnected()
Shows whether the component is connected. Use this property to determine whether the control is connected to the remote host or not.


getFirewallData

public byte[] getFirewallData()
Used to send other data to firewall. When the firewall is a tunneling proxy, use this property to to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).


setFirewallData

public void setFirewallData(byte[] firewallData)
                     throws IPWorksException
Used to send other data to firewall. When the firewall is a tunneling proxy, use this property to to send custom (additional) headers to the firewall (e.g. headers for custom authentication schemes).


getFirewallHost

public java.lang.String getFirewallHost()
Name or IP address of firewall (optional). If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

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


setFirewallHost

public void setFirewallHost(java.lang.String firewallHost)
                     throws IPWorksException
Name or IP address of firewall (optional). If a FirewallHost is given, requested connections will be authenticated through the specified firewall when connecting.

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


getFirewallPassword

public java.lang.String getFirewallPassword()
A password if authentication is to be used connecting through the firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallPassword

public void setFirewallPassword(java.lang.String firewallPassword)
                         throws IPWorksException
A password if authentication is to be used connecting through the firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


getFirewallPort

public int getFirewallPort()
Port of the firewall to connect to. The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


setFirewallPort

public void setFirewallPort(int firewallPort)
                     throws IPWorksException
Port of the firewall to connect to. The TCP port for the FirewallHost . See the description of the FirewallHost property for details.

Note that the FirewallPort is set automatically when FirewallType is set to a valid value. See the description of the FirewallType property for details.


getFirewallType

public int getFirewallType()
Determines the type of firewall to connect through. The applicable values are the following:
fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


setFirewallType

public void setFirewallType(int firewallType)
                     throws IPWorksException
Determines the type of firewall to connect through. The applicable values are the following:
fwNone (0)
No firewall (default setting).
fwTunnel (1)
Connect through a tunneling proxy. FirewallPort is set to 80.
fwSOCKS4 (2)
Connect through a SOCKS4 Proxy. FirewallPort is set to 1080.
fwSOCKS5 (3)
Connect through a SOCKS5 Proxy. FirewallPort is set to 1080.


getFirewallUser

public java.lang.String getFirewallUser()
A user name if authentication is to be used connecting through a firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


setFirewallUser

public void setFirewallUser(java.lang.String firewallUser)
                     throws IPWorksException
A user name if authentication is to be used connecting through a firewall. if FirewallHost is specified, the FirewallUser and FirewallPassword properties are used to connect and authenticate to the given firewall. If the authentication fails, a trappable error is fired.


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 and more can also be retrieved through the PITrail event.


getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.

If the control 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).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted. The LocalHost property contains the name of the local host as obtained by the gethostname() Winsock call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the control initiate connections (or accept in the case of server controls) only through that interface.

If the control 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).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


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.


getTimeout

public int getTimeout()
A timeout for the component. If the Timeout property is set to 0 (default value) all actions will run uninterrupted until succesful completion, or an error condition is encountered.

If Timeout is set to a positive value, and any action does not complete within Timeout seconds, the action is aborted, and a 'Timeout' error is fired..

The control will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and always remains responsive.


setTimeout

public void setTimeout(int timeout)
                throws IPWorksException
A timeout for the component. If the Timeout property is set to 0 (default value) all actions will run uninterrupted until succesful completion, or an error condition is encountered.

If Timeout is set to a positive value, and any action does not complete within Timeout seconds, the action is aborted, and a 'Timeout' error is fired..

The control will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and always remains responsive.


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 server, and the respective replies. (Called internally to dispatch the event.)
See Also:
SnppPITrailEvent

connect

public void connect()
             throws IPWorksException
Connect to an SNPP serer. Connects to the SNPP server. Any number of messages can later be sent using the smtpSendMessage action below.

Calling this method is equivalent to setting the Action property to snppConnect .


disconnect

public void disconnect()
                throws IPWorksException
Disconnect from an SNPP gateway. Disconnects from the SNPP gateway.

Calling this method is equivalent to setting the Action property to snppDisconnect .


reset

public void reset()
           throws IPWorksException
Resets the server state created during the connection. Resets the server state created during the connection, so that a new message may be sent to the gateway using the already established connection.

Calling this method is equivalent to setting the Action property to snppReset .


send

public void send()
          throws IPWorksException
Send the current message. If the control is not connected to the SNPP server, a connection is created. Then the control attempts to deliver the current message.

Calling this method is equivalent to setting the Action property to snppSend .


addSnppEventListener

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

removeSnppEventListener

public void removeSnppEventListener(SnppEventListener l)

IP*Works!

Copyright (c) 2001 /n software inc. - All rights reserved.