且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

java.net.SocketException异常:recvfrom的失败:ECONNRESET(连接被对方​​复位)

更新时间:2021-11-27 08:10:48

当我用下面的code片段通过DefaultHttpServerConnection属性为handle()方法,我没有得到这个异​​常:

When I passed the DefaultHttpServerConnection attribute to the handle() method using the following code snippet, I did not get this exception:

在的WorkerThread类,使用下面的code传递DefaultHttpServerConnection连接对象:

In the WorkerThread class, pass the DefaultHttpServerConnection connection object using the following code:

HttpContext context = new BasicHttpContext(null);
context.setAttribute("XXX",this.conn);

在手柄()方法,用得到的连接对象,

In the handle() method, get the connection object using,

(DefaultHttpServerConnection)context.getAttribute("XXX");

希望它可以帮助别人!

Hope it helps someone!