Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 22
Registered: ‎10-05-2012
My Device: 9800
My Carrier: 0

Server connection timed out while i am sending images(Size:400 KB)

[ Edited ]

While i am sending images(Size:400 KB) via intranet to server i can send successfully but Server connection timed out while i am sending images(Size:400 KB) via internet to server.

 

 Please help me........

 

 

 

 

Thanks,

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Server connection timed out while I am sending images(Size:400 KB)

Welcome to the forums.

 

Can you clarify the problem a little.  With the information we have so far, we are just guessing. 

 

So give us as much information as you can, including the answers to the following questions:

Are the files actually begin sent to the Server completely? 

How are you sending the files? 

Is the problem on device or on the Simulator?

What level of OS are you using?

Contributor
Posts: 22
Registered: ‎10-05-2012
My Device: 9800
My Carrier: 0

Re: Server connection timed out while I am sending images(Size:400 KB)

[ Edited ]

Thanks for your replay.

 

  1.  I am reading the image and encoding with Base64 encoder than adding the encoded string to json and sent to server. please find the below code.

 

byte[] Buffer=null;
byte[] encoded = null;
StringBuffer raw = new StringBuffer();
try{
   Buffer = readFile(pathNameForImage);
   raw.append(new String(Buffer, 0, Buffer.length));
   contentBody = raw.toString();
   encoded = Base64OutputStream.encode(contentBody.getBytes(), 0, contentBody.getBytes().length,false, false);
   encodedString = new String(encoded,"UTF-8");
   }catch (Exception e) {
    System.out.println("=============>"+e.getMessage());
  }

 

3. problem in both simulator(8520) and device(9780).

4.os level 5.0

 

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Server connection timed out while I am sending images(Size:400 KB)

Sorry more detail especially around how you are sending it ( HTTP POST I presume) and exactly what happens on the BB end.  Are you specifying your own connection string (e.g. ";deviceside=true") or are you using ConnectionFactory?

 

You have not told us what the Server sees either. 

 

What other testing have you done?  Have you any transmissions that actually work?  Have you tried a smaller file to see if the timeout is size related?

 

Your question originally was the equivalent of "my car isn't going' which doesn't help anyone resolve the problem.  You have to give us as much information as you can so that we don't get to start looking at the starter motor when the problem is in fact the battery. 

Contributor
Posts: 22
Registered: ‎10-05-2012
My Device: 9800
My Carrier: 0

Re: Server connection timed out while I am sending images(Size:400 KB)

i am using my own connection string with http GET method.From client to middleware we are sending request in json format and from middleware they are invoking webservices.

 

i have tried with smaller image file(3KB)  but not able to send that smaller file also. Instead of sending image i have tried sending string that time also it was not working.

 

Is there any settings need to do in  simulator or device and any other ways?

Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Server connection timed out while I am sending images(Size:400 KB)

There are two places to start.

 

1) It would be very unusual to send this sort of data using a GET.  So check up with your Server requirements.  I am betting you should be sending a POST

2) I think there is possibly an issue with your connection string.  Since it is failing on the Simulator, for now we can ignore on device testing.  For testing on Simulator, use the connection String ";deviceside=true".  We can address setting the connection string correctly when you have it working on the Simulator with ";deviceside=true".

 

I hope I am not being rude, but you are still not giving as much as you can.  Saying "it is not working" is the same as saying "my car is not working".  It does not help us determine what the problem is.  Please give us as much information as you can.  There is bound to be an exception thrown for example.  And you haven't told us what the Server sees. 

 

The more information you give us, the more chance we have of getting you to look in the right place.  And remember people here don't have a lot of time.  We are not going to spend more time helping people who have identified the problem and given more information than with people who have not researched their problem themselves.

 

For example in this case, your original post says the connection timed out while sending an image of a specific size.  But that is not correct, any data of any size will see the problem.  That is a completely different problem.  Someone focusing on your original statement could have you researching image formats for example which is not relevant. 

 

So work the problem yourself to tie down exactly what happens and then give us everything that you can.

 

OK?