如何处理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 (将#修改为@)