Logica SMPP API在使用中,存在一些问题,列举如下:
1. 支持长短信,在SubmitSM.java类中加入方法setShortMessageData
/**
* added by zcg 2012-01-18
* 处理长短信
*
* @param buffer
* @throws WrongLengthOfStringException
*/
public void setShortMessageData(ByteBuffer buffer) throws WrongLengthOfStringException{
try{
this.shortMessage.setData(buffer);
} catch (Exception e) {
if ((e instanceof WrongLengthOfStringException)) {
throw ((WrongLengthOfStringException)e);
}
throw new WrongLengthOfStringException();
}
setSmLength((short)this.shortMessage.getLength());
}
2. 支持SME客户端绑定指定端口,修改TCPIPConnection.java类open方法
// start, modified by zcg 2012-10-08
if(localAddress != null && localPort != 0){
SocketAddress bindPoint = new InetSocketAddress(localAddress, localPort);
socket = new Socket();
socket.setReuseAddress(true);
socket.bind(bindPoint);
SocketAddress endPoint = new InetSocketAddress(address, port);
socket.connect(endPoint, timeout);
}else{
socket = new Socket(address, port);
}
// end, modified by zcg 2012-10-08