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

Native Development

Reply
Visitor
bisprojectyossi
Posts: 1
Registered: ‎03-05-2013
My Device: 9800

9900 http connection problem

hi i have a problem with bb 9900 device

when i try to connect to webdav servers like mydrive.ch , mydisk.se

and send upload request to the server it throw 'connection close exception' after uploading 2mb

any idea why this happends ?

 

Please use plain text.
Developer
danielleCoder
Posts: 178
Registered: ‎04-16-2011
My Device: torch 9800

Re: 9900 http connection problem

I have done some uploading to servers in the past on BB java (ConnectionClosedException was very common) and the key to this problem was to send your POST request in consistent chunks (so you don't cause problems for bb jvm by writing too much at once  or for server by writing inconsistently sized chunks). I used Sockets for this btw.

 

So first I would create the http headers including Content-Length:  and Content-Type: and convert to bytes and then append some more data (whatever your trying to upload) to make the first chunk 4096 and then loop the rest of the file your uploading and write the chunks 4096 at a time.

 

If you have your headers correct and have worked out your Content length (this is headers bytes size + file to be uploaded bytes size) correctly the server should give you a response even if it's to let you know it's a invalid request.

 

Hope this helps. (probably best posting in java forums next time).

Please use plain text.