发布网友 发布时间:2022-04-26 09:58
共2个回答
热心网友 时间:2022-06-27 02:26
socket.setKeepAlive()应该写在客户端,server.accept()是服务器端的。
心跳的也有现成的,不过依赖别的类。大概贴一下,就是这么个意思。
public class HBHBCommandDeal extends CommandDealInterface {
private static Logger msg_logger = Logger.getLogger("socketMsg");
@SuppressWarnings("unchecked")
public List doCommand(SocketQueueObject socketQueueObject, Map command) throws Exception {
List<String> commandList = (List) command.get(Constants.SMSCOMMAND);
byte[] hbhbMsg = TL1Tool.createCommand(commandList.get(0));
msg_logger.info(" send message to sms packed:" + new String(hbhbMsg, "ISO-8859-1"));
TL1RetrunMessage retMsg = socketQueueObject.commNGNServer(hbhbMsg);
retMsg.resolve();
msg_logger.info(" recevice message from sms:"+ retMsg.getMessage());
List returnList = new ArrayList();
returnList.add(retMsg);
return returnList;
}
}
你可以自己找找看啊。
热心网友 时间:2022-06-27 02:26
我没做过这个开发,但我觉得socket.setKeepAlive()应该写在客户端,server.accept()是服务器端的。这两个不应该写在一起。供参考。