📄 smppsendreveive.java
字号:
/*
* Copyright (c) 1996-2001
* Logica Mobile Networks Limited
* All rights reserved.
*
* This software is distributed under Logica Open Source License Version 1.0
* ("Licence Agreement"). You shall use it and distribute only in accordance
* with the terms of the License Agreement.
*
*/
package com.smpp.server;
import java.io.IOException;
import noNamespace.SMSCType;
import com.logica.smpp.Session;
import com.logica.smpp.SmppObject;
import com.logica.smpp.debug.Debug;
import com.logica.smpp.debug.Event;
import com.logica.smpp.debug.FileDebug;
import com.logica.smpp.debug.FileEvent;
/**
* Class <code>SMPPTest</code> provides all methods necessary for
* communication with SMSC using the SMPP protocol.
*/
class SMPPSendReveive implements Runnable
{
/**
* Directory for creating of debug and event files.
*/
private String dbgDir = "./";
/**
* The debug object.
*/
private Debug debug = null;
/**
* The event object.
*/
private Event event = null;
/**
* File with default settings for the application.
*/
// static BufferedReader keyboard = new BufferedReader(new
// InputStreamReader(System.in));
/**
* This is the SMPP session used for communication with SMSC.
*
* @see com.logica.smpp.Session
*/
private Session session = null;
/**
* Contains the parameters and default values for this test application such
* as system id, password, default npi and ton of sender etc.
*/
GatewayProperties gp = null;
/**
* If the application has to keep reading commands from the keyboard and to
* do what's requested.
*/
private SMSCType prop;
public SMPPSendReveive(SMSCType prop) throws IOException
{
System.out.println("Initialising...");
debug = new FileDebug(dbgDir, prop.getSystemId() + ".dbg.txt");
event = new FileEvent(dbgDir, prop.getSystemId() + ".evt.txt");
debug.activate();
event.activate();
SmppObject.setDebug(debug);
SmppObject.setEvent(event);
this.prop = prop;
}
/**
* Sets global SMPP library debug and event objects. Runs the application.
*/
public void run()
{
gp = new GatewayProperties(prop);
gp.setEvent(event);
gp.setDebug(debug);
SessionManager sm = new SessionManager(gp);
session = sm.bind();
PDUReceiver pduReceiver = new PDUReceiver(gp, session);
Thread thr = new Thread(pduReceiver);
thr.start();
PDUSender pduSender = new PDUSender(gp, session);
Thread ths = new Thread(pduSender);
ths.start();
}
/**
* Displays the menu and lets you choose from available options.
*/
/**
* The first method called to start communication betwen an ESME and a SMSC.
* A new instance of <code>TCPIPConnection</code> is created and the IP
* address and port obtained from user are passed to this instance. New
* <code>Session</code> is created which uses the created
* <code>TCPIPConnection</code>. All the parameters required for a bind
* are set to the <code>BindRequest<code>
* and this request is passed to the <code>Session</code>'s <code>bind</code>
* method. If the call is successful, the application should be bound to the SMSC.
*
* See "SMPP Protocol Specification 3.4, 4.1 BIND Operation."
*/
/**
* Ubinds (logouts) from the SMSC and closes the connection.
*
* See "SMPP Protocol Specification 3.4, 4.2 UNBIND Operation."
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -