zyneo.sms.gateway.adaptor.xml.tcp.client
Class SendConnection

java.lang.Object
  |
  +--zyneo.sms.gateway.adaptor.xml.tcp.client.SendConnection

public class SendConnection
extends java.lang.Object

A connection used for sending SMS-messages by using XML/tcp-protocol. The send-connection can run in either of two modes, transient connection and continous conection. Transient connection means that for each call to send a new connection is established, and it is closed afterwards. Continues connection means that a connection is kept and used for all messages. Continues mode is entered when the client explicity calls the connect() method.

Author:
Niklas Andersson

Field Summary
static int DEFAULT_CONNECTION_TIMEOUT
           
static int DEFAULT_FRAMEDELAY
           
protected  ClientConnection m_cc
           
protected  int m_connection_timeout
           
protected  int m_framedelay
           
protected  java.lang.String m_host
           
protected  Category m_log
           
protected  int m_port
           
 
Constructor Summary
SendConnection(java.lang.String host, int port)
          Constructor
SendConnection(java.lang.String host, int port, int connection_timeout, int frame_delay)
          Constructor
 
Method Summary
protected  boolean connect_internal()
          Connects to gateway
 void connect()
          Establishes a connection to gateway.
protected  void disconnect_internal()
          Disconnect from gateway
 void disconnect()
          Disconnect from Gateway.
 java.lang.String send(Sms s)
          Sends a SMS-message to Gateway
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONNECTION_TIMEOUT

public static final int DEFAULT_CONNECTION_TIMEOUT
See Also:
Constant Field Values

DEFAULT_FRAMEDELAY

public static final int DEFAULT_FRAMEDELAY
See Also:
Constant Field Values

m_host

protected java.lang.String m_host

m_port

protected int m_port

m_connection_timeout

protected int m_connection_timeout

m_framedelay

protected int m_framedelay

m_cc

protected ClientConnection m_cc

m_log

protected Category m_log
Constructor Detail

SendConnection

public SendConnection(java.lang.String host,
                      int port)
Constructor

Parameters:
host - The hostname for server running Gateway
port - The port the XML/tcp Send Adaptor is listening on

SendConnection

public SendConnection(java.lang.String host,
                      int port,
                      int connection_timeout,
                      int frame_delay)
Constructor

Parameters:
host - The hostname for server running Gateway
port - The port the XML/tcp Send Adaptor is listening on
connection_timeout - Connection timeout (in milliseconds)
Method Detail

connect

public void connect()
             throws java.io.IOException,
                    java.net.UnknownHostException
Establishes a connection to gateway. When connect-method is called, then the continues-mode of operation is used.

Throws:
IOException,UnknownHostException
java.io.IOException
java.net.UnknownHostException

disconnect

public void disconnect()
                throws java.io.IOException
Disconnect from Gateway. Only needs to be called when using continous mode of operation.

Throws:
java.io.IOException

send

public java.lang.String send(Sms s)
                      throws RequestException,
                             java.io.IOException,
                             java.net.UnknownHostException
Sends a SMS-message to Gateway

Parameters:
s - The message to send
Returns:
Message identifier
Throws:
RequestException,IOException,UnknownHostException
RequestException
java.io.IOException
java.net.UnknownHostException

connect_internal

protected boolean connect_internal()
                            throws java.io.IOException,
                                   java.net.UnknownHostException
Connects to gateway

Returns:
True if a new connection was created, otherwise false.
java.io.IOException
java.net.UnknownHostException

disconnect_internal

protected void disconnect_internal()
                            throws java.io.IOException
Disconnect from gateway

java.io.IOException


Copyright © 2002 Zyneo. All Rights Reserved.