/*** Obtain the IP address of a non-lan ** @ return * @ author SHANHY */public static String getPsdnIp () {String ipurl = "http://whois.pconline.com.cn/ipJson.jsp"; String ss = null; httpURLConnection urlConnection = null; try {URL url = new URL (ipurl); urlConnection = (HttpURLConnection) url. openConnection (); urlConnection. setDoInput (true); urlConnection. setConnectTimeout (WoConfiguration. TI ME_OUT_LENGTH); urlConnection. setReadTimeout (WoConfiguration. TIME_OUT_LENGTH); urlConnection. setRequestProperty ("Content-Type", "application/x-www-form-urlencoded"); urlConnection. connect (); int response = urlConnection. getResponseCode (); if (response = HttpConnection. HTTP_ OK) {InputStream in = urlConnection. getInputStream ();//. openInputStream (); ByteArrayOutputStream baos = new ByteArrayOutput Stream (); byte [] buff = new byte [1024]; int rc = 0; while (rc = in. read (buff, 0, 1024 ))! =-1) {baos. write (buff, 0, rc);} byte [] content = baos. toByteArray (); ss = new String (content); in. close (); in = null; baos. close (); baos = null; JSONObject sn = new JSONObject (ss. substring (ss. indexOf ("({") + 1, ss. indexOf ("})") + 1); ss = sn. getString ("ip");} else {}} catch (Exception e) {e. printStackTrace () ;}} catch (Exception e) {return null;} finally {if (urlConnection! = Null) {urlConnection. disconnect (); //. close (); urlConnection = null ;}} return ss ;}