Package ie.omk.smpp.net

Examples of ie.omk.smpp.net.TcpLink


  private Connection connect(int port) throws UnknownHostException {
    APIConfig.getInstance().setProperty(APIConfig.BIND_TIMEOUT, 3000 + "");
    APIConfig.getInstance().setProperty(APIConfig.LINK_TIMEOUT, 3000 + "");

    TcpLink link = new TcpLink("localhost", port);
    Connection connection = new Connection(link, false);
    connection.autoAckLink(true);
    connection.autoAckMessages(true);

    return connection;
View Full Code Here


     *
     * @return
     * @throws Exception
     */
    private Connection bind() throws Exception {
      TcpLink link = null;

      try {
        link = new TcpLink(configuration.getHost(), configuration.getPort());
        connection = new Connection(link, true);
        autoAckMessages(connection);

        MessageListener messageListener = new MessageListener();
        connection.addObserver(messageListener);

        connection.bind(getConnectionType(configuration), configuration.getSystemId(), configuration.getPassword(), configuration.getSystemType(),
            getBindTON(), getBindNPI(), null);

        BindResp bindResp = messageListener.getBindResponse(configuration.getBindTimeout());
        if (bindResp == null || bindResp.getCommandStatus() != 0) {
          // close the link if no response
          if (link != null) {
            try { link.close(); } catch (Exception f) {}
          }
          throw new Exception("Bind Response failed: " + bindResp);
        }

        return connection;
      } catch (Exception e) {
        // close the link if an exception was thrown
        if (link != null) {
          try { link.close(); } catch (Exception f) {}
        }

        throw e;
      }
    }
View Full Code Here

     *            the port to connect to. If 0, use the default SMPP port
     *            number.
     */
    public Connection(String host, int port)
            throws java.net.UnknownHostException {
        this(new TcpLink(host, port), false);
    }
View Full Code Here

     * @param async
     *            true for asyncronous communication, false for synchronous.
     */
    public Connection(String host, int port, boolean async)
            throws java.net.UnknownHostException {
        this(new TcpLink(host, port), async);
    }
View Full Code Here

     *            the port to connect to. If 0, use the default SMPP port
     *            number.
     */
    public Connection(String host, int port)
            throws java.net.UnknownHostException {
        this(new TcpLink(host, port), false);
    }
View Full Code Here

     * @param async
     *            true for asyncronous communication, false for synchronous.
     */
    public Connection(String host, int port, boolean async)
            throws java.net.UnknownHostException {
        this(new TcpLink(host, port), async);
    }
View Full Code Here

TOP

Related Classes of ie.omk.smpp.net.TcpLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.