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: 42
Registered: ‎06-14-2010
My Device: 8900 Bold, 9300
My Carrier: Vodafone
Accepted Solution

Understand device log: TXch & TXun

Hi,

 

I use an FTP connection to send compressed text file.

I have a big problem with file larger than 40K.

 

Basically the process is:

- generate a String with data;

- compress it using something similar to GZipOutputStream sample;

- connect to FTP server using socket connection

- send it

 

the code of send is something like this: 

 

 

OutputStream output = dataSocket.openOutputStream();
byte[] buffer = new byte[512];
int bytesRead = 0;

while ((bytesRead = inputStream.read(buffer)) != -1) {
	output.write(buffer, 0, bytesRead);
}
output.flush();
output.close();
output = null;
dataSocket.close();
dataSocket=null;

 

All work good with file smaller than 40K, but larger are send corrupted.

I try to open it on FTP server and the error message is unexpected end of file.

 

Trying it on device, I see that on log event there are some strange warning:

 

E net.rim.tcp - TXch

E net.rim.tcp - TXun

... repeated several times

 

Any idea?

 

To solve it i try to break file into 40K file, but I don't like it so much.

 

Thank for help!

 

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

Re: Understand device log: TXch & TXun

There are limits to how much data you can send in a single connection using wireless (non WiFi) connections on a BlackBerry.  These limits depend on a number of factors, including the type of file (for example using a browser you can download large mp3 files).

 

You will find more information here:

http://supportforums.blackberry.com/t5/Java-Development/HTTP-413-Request-Entity-Too-Large/ta-p/44598...

 

In this case, the device does not know what sort of file you are downloading.  In addition, I've seen comments from people downloading gzipped files that  it seems like these get unzipped in terms of counting bytes (possible, since the MDS probably thinks it can get better compression than gzip).  Your magic figure of 40K has also been mentioned in some posts, have a look here:

http://supportforums.blackberry.com/t5/Java-Development/maximum-chunk-to-read-data-from-input-stream...

 

Anyway, I tsuspect the short answer is that it is unlikely that you will be able to transfer, in  a single block, using ftp, a large file.  I think you are going to have to chunk it up.

 

Alternatively, you could look at the more complicated ftp protocol that involves blocking.  That will depend on your ftp Server. 

Contributor
Posts: 42
Registered: ‎06-14-2010
My Device: 8900 Bold, 9300
My Carrier: Vodafone

Re: Understand device log: TXch & TXun

Thank!

 

Finally i chunk the data into <40KB files and all work great.

 

Thank you for answer, very interesting