如何解决如何处理Java中的远程主机强行关闭现有连接?
我正在一个项目中,必须绑定外部服务器。我的问题是如果连接终止如何处理?
我的应用程序属性文件。
smpp.connections.one.credentials.host=10.70.12.201
smpp.connections.one.credentials.password=pG@ADL#2
smpp.connections.one.credentials.port=5016
smpp.connections.one.credentials.username=Payment_ADL
我的控制器类
@RequestMapping(value = "/sendSMS/{toNum}/{msg}",method = RequestMethod.GET)
public Response sendSMS(@PathVariable String toNum,@PathVariable String msg) {
logger.info("Sending SMS start to {}",toNum);
Response response = new Response();
try {
smsServices.simpleSMS(toNum,msg );
response.setCode("200");
response.setMessage("SUCCESS");
}catch (Exception e){
logger.error("Sending SMS Fail {}",e);
response.setMessage(e.getMessage());
}
return response;
}
这是我得到的例外情况
“ java.io.IOException:现有连接被远程主机强行关闭”
有人可以在这里帮助我吗? 谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。