我得到以下代码片段:
final ISOMsg isoMsg = new ISOMsg();
isoMsg.setPackager(packager);
isoMsg.setMTI("0800");
isoMsg.set(3, "9A0000");
isoMsg.set(7, ISODate.formatDate(now, "MMddHHmmss"));
isoMsg.set(11, "123456");
isoMsg.set(12, ISODate.formatDate(now,"HHmmss"));
isoMsg.set(13, ISODate.formatDate(now,"MMdd"));
isoMsg.set(41, "20390040");
isoMsg.set(62,"0100820390040");
XMLChannel channel = new XMLChannel("xx.xx.xx.xxx", 1234, packager);
try{
logger.addListener(new SimpleLogListener(System.out));
//channel.setPackager(packager);
channel.setLogger(logger, "server-request-channel");
channel.setTimeout(30000);
channel.setHeader(isoMsg_.pack());
channel.connect();
}catch (Exception ex){
System.out.println(ex.getMessage());
}
try{
channel.send(isoMsg_);
ISOMsg serverResponse = channel.receive();
Log.i("response",new String(serverResponse.pack()));
}catch(ISOException ex){
System.out.println(ex.getMessage());
}catch(Exception e){
System.out.println(e.getMessage());
}
每当它落在以下行时,我都会收到一条“对等断开连接”消息:
ISOMsg serverResponse = channel.receive();
以下是日志
<log realm="server-request-channel/xx.xx.xx.xx:1234" at="Fri Aug 14 11:06:04 WAT 2015.900">
<connect>
xx.xx.xx.xx:1234
</connect>
</log>
<log realm="server-request-channel/xx.xx.xx.xx:1234" at="Fri Aug 14 11:06:04 WAT 2015.927">
<send>
<isomsg direction="outgoing">
<field id="0" value="0800"/>
<field id="3" value="9A0000"/>
<field id="7" value="0816210554"/>
<field id="11" value="123456"/>
<field id="12" value="210554"/>
<field id="13" value="0816"/>
<field id="41" value="20390040"/>
<field id="62" value="0100820390050"/>
</isomsg>
</send>
</log>
<log realm="server-request-channel/41.58.130.138:55533" at="Fri Aug 14 11:06:04 WAT 2015.958">
<receive>
<peer-disconnect/>
</receive>
</log>
我不知道我是不是在做正确的事情,或者我缺少什么。这假设是一个简单的(我想)网络管理请求。我该如何解决这个问题?