How do you make an HttpURLconnection break the connection? I've already tried disconnect() but it doesn't seem to work.

Tim Rohaly

From the javadocs, "Calling the disconnect() method may close the underlying socket if a persistent connection is otherwise idle at that time."

There is no way to force a shut down of an active connection - the HttpURLConnection handles its own protocol. You need to either use sockets directly, implement your own protocol handler, or modify your application architecture to accomodate this behavior.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact