i have standalone java program sending data server. using method send request.
try { url url = new url(url + "?prak=" + urlparameters); httpurlconnection connection = (httpurlconnection) url .openconnection(proxy.no_proxy); connection.setrequestmethod("get"); connection.setconnecttimeout(1000); connection.setdoinput(true); connection.setdooutput(false); connection.setusecaches(false); connection.connect(); int code = connection.getresponsecode(); if (code >= 200 && code < 300) { system.out.println("success"); } else { system.out.println("failed"); } }catch (exception e){ system.out.println("exception occur" + e.getmessage() ); }
the success rate of connection 70%. need send data fast using timout of 1000. dont want increase timeout. , due throwing timeout exception. please suggest me more reliable , fast way establish connection.
Comments
Post a Comment