[android-developers] Fwd: Sending 15KB Data via HTTP POST and got java.io.FileNotFoundException !! ?

2011-11-07 Thread Nassem Zaher
Please need advise !

-- Forwarded message --
From: Nassem Zaher nasse...@gmail.com
Date: Sat, Nov 5, 2011 at 9:06 PM
Subject: Sending 15KB Data via HTTP POST and got
java.io.FileNotFoundException !! ?
To: Android Developers android-developers@googlegroups.com


Hi

I am trying to send data via HTTP POST from my android application and
i got java.io.FileNotFoundException !
Note :
1) i tried to send smallest data +- 1KB and it successes !
2) in small data Server reached and data revived
3) in the 16KB , server doesn't reached - got exception while trying
to get the response !
4) full exception : java.io.FileNotFoundException:
http://myserverip:80/APP/Default.aspx

Code :

String connectionString = http://; + url + : + port + / +
uploadApp;
URL urle = new URL(connectionString);

URLConnection httppost = urle.openConnection();
connection = (HttpURLConnection) httppost;
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setConnectTimeout(1000*60*2); // 2 min
connection.setRequestMethod(POST);
connection.connect();
outputStream = new BufferedOutputStream(connection.getOutputStream(),
17000);
//for example start
byte[] data = new byte[16000];
for(int i = 0 ; i  data.length ; i++)
 data[i] = 4;
//for example end
outputStream.write(data);
outputStream.flush();
outputStream.close();


inputStream = connection.getInputStream(); // Here i got the
exception
!!
BufferedReader rd = new BufferedReader(new
InputStreamReader(inputStream));
String tmp = rd.readLine();
rd.close();


Any Ideas !?




-- 
Regards,
Nassem Zaher
Computer Science BSc
Nazareth 16470, Israel, P.O.Box 6776.
nasse...@gmail.com

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Fwd: Sending 15KB Data via HTTP POST and got java.io.FileNotFoundException !! ?

2011-11-07 Thread Júlio Cesar Bueno Cotta
I just guess..I am not sure...but
When you close the output..don't you close the connection?
Have you monitoring the server side to any problens with this greater size?
Good luck

2011/11/5 Nassem Zaher nasse...@gmail.com

  Please need advise !


 -- Forwarded message --
 From: Nassem Zaher nasse...@gmail.com
 Date: Sat, Nov 5, 2011 at 9:06 PM
 Subject: Sending 15KB Data via HTTP POST and got
 java.io.FileNotFoundException !! ?
 To: Android Developers android-developers@googlegroups.com


 Hi

 I am trying to send data via HTTP POST from my android application and
 i got java.io.FileNotFoundException !
 Note :
 1) i tried to send smallest data +- 1KB and it successes !
 2) in small data Server reached and data revived
 3) in the 16KB , server doesn't reached - got exception while trying
 to get the response !
 4) full exception : java.io.FileNotFoundException:
 http://myserverip:80/APP/Default.aspx

 Code :

 String connectionString = http://; + url + : + port + / +
 uploadApp;
 URL urle = new URL(connectionString);

 URLConnection httppost = urle.openConnection();
 connection = (HttpURLConnection) httppost;
 connection.setDoInput(true);
 connection.setDoOutput(true);
 connection.setConnectTimeout(1000*60*2); // 2 min
 connection.setRequestMethod(POST);
 connection.connect();
 outputStream = new BufferedOutputStream(connection.getOutputStream(),
 17000);
 //for example start
 byte[] data = new byte[16000];
 for(int i = 0 ; i  data.length ; i++)
  data[i] = 4;
 //for example end
 outputStream.write(data);
 outputStream.flush();
 outputStream.close();


 inputStream = connection.getInputStream(); // Here i got the
 exception
 !!
 BufferedReader rd = new BufferedReader(new
 InputStreamReader(inputStream));
 String tmp = rd.readLine();
 rd.close();


 Any Ideas !?




 --
 Regards,
 Nassem Zaher
 Computer Science BSc
 Nazareth 16470, Israel, P.O.Box 6776.
 nasse...@gmail.com

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Júlio Cesar Bueno Cotta
Bacharel em Ciência da Computação pela UFV
Mestrando em Ciência da Computação pela UFABC

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en