0

I got this error from my program when i am call a URL from URLConnector.. the URL is

http://192.168.2.107/cgi-bin/mediaFileFind.cgi?action=findFile&object=27544704&condition.Channel=0&conditon.Dir[0]="/mnt/sd"&condition.StartTime=2014-8-1 00:00:00&condition.EndTime=2014-8-31 23:59:59

but when i capture HTTP using wire-shark then wire-shark the URl is loss wire-shark capture only

  http://192.168.2.107/cgi-bin/mediaFileFind.cgi?action=findFile&object=27544704&condition.Channel=0&conditon.Dir[0]="/mnt/sd"&condition.StartTime=2014-8-1 00:00:00

only this URL

my Java program is

public String intilizeObject(String IP, String user, String pass, String objectID, String dir, String startTime, String endTime) {
        String result = "";
        try {
            String URL = "http://" + IP + "/cgi-bin/mediaFileFind.cgi?action=findFile&object=" + objectID + "&condition.Channel=0&conditon.Dir[0]=\"" + dir + "\"&condition.StartTime=" + startTime + "&condition.EndTime=" + endTime;           
            String authString = user + ":" + pass;
            byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
            String authStringEnc = new String(authEncBytes);
            URL url = new URL(URL);
            System.out.println(url);
            URLConnection urlConnection = url.openConnection();
            urlConnection.setRequestProperty("Authorization", "Basic " + authStringEnc);

            InputStream is = urlConnection.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);

            int numCharsRead;
            char[] charArray = new char[1024];
            StringBuffer sb = new StringBuffer();
            while ((numCharsRead = isr.read(charArray)) > 0) {
                sb.append(charArray, 0, numCharsRead);
            }
            result = sb.toString();

        } catch (Exception e) {
            result = e.toString();
        }
        return result;
    }
  • @user3218114 The OP isn't passing *anything* with this GET request. What are you talking about? – user207421 Aug 02 '14 at 09:35
  • I found some thing at this link, try check this [java.net.SocketException: Unexpected end of file from server][1] [1]: http://stackoverflow.com/questions/22147457/caused-by-java-net-socketexception-unexpected-end-of-file-from-server – taynguyen Oct 29 '14 at 09:39

0 Answers0