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
New Contributor
ffranzoni
Posts: 7
Registered: ‎03-16-2012
My Device: Several models
My Carrier: Several provider

Data are buffered unexpectedly (socket connection)

My application sends and receives continuous data over a socket connection (deviceside = true).
I write about 500 to 2000 bytes to the output stream and flush it after the write operation.
Normally the data are sent immediately to the receiver (a windows based application), but with a Torch 9860 (OS 7) I have an issue.
On this device sometimes sending data slows down and stops.
In my application all looks good, the write and flush call returns immediatly without an exception.
The data are not lost but were buffered somewhere, I suppose in the tcp stack of the device.
When I open a website in the browser all the buffered data are send to the receiver.
Without opening the browser I have observed that several minutes no data are sent.
The strange thing is that this does not happen in all environments.
I have tested the same application on the Torch 9860 in several WLAN environments, in most of them it works as expected.
I have no idea what triggers this behaivour in the bad environment.
I've played around a bit with the settings for the send buffer size, with smaller values for the buffer size it looks better.
Hopefully someone can answer me the following questions.
Where are the data buffered?
In the tcp stack or in the send buffer I can configure for my connection?
Why does opening a browser send the buffered data?
How can I force this in my application?
I think flush should do the job, it does it in most of the enviroments.
Why does this only happen only in one of my tested WLAN environments?
What can be the network configuration settings that triggers this behaivour?

Thanks.

Please use plain text.
Developer
Aviator168
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: Data are buffered unexpectedly (socket connection)

Try disabling the Nagel's algorithm   setSocketOption(DELAY, 0)

Please use plain text.
New Contributor
ffranzoni
Posts: 7
Registered: ‎03-16-2012
My Device: Several models
My Carrier: Several provider

Re: Data are buffered unexpectedly (socket connection)

I forget to mention that the Nagel's algorithm  is disabled.

But I think the Nagel's algorithm is not a explanation for the behaviour, this algorithm does not buffer for several minutes.

Please use plain text.
Developer
Aviator168
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: Data are buffered unexpectedly (socket connection)

If the problem is environment specific, you should take a look at all the devices the traffic goes through. 

Please use plain text.
New Contributor
ffranzoni
Posts: 7
Registered: ‎03-16-2012
My Device: Several models
My Carrier: Several provider

Re: Data are buffered unexpectedly (socket connection)

I was wrong that decreasing the send the buffer size  of the connection improves the situation, but I have noticed that writing faster to the socket improves it.

 

In the original code I wrote about every 300ms to the socket. I have decreased this value to 100ms and it seems that no data are buffered any longer.
But this is only a workaround, I would like to understand what happens.

 

I have also found that the behaviour occurs with several OS 7 devices but not with OS 6 devices in the same environment.

 

Exists a tool like wireshark for blackberry?
In the bad environment I can check network traffic only on the device.

 

 

Please use plain text.
Developer
Aviator168
Posts: 709
Registered: ‎09-10-2009
My Device: 8520, 8900, 9000, 9300, 9650, 9700, 9780, 9800, 9810, 9900, 9930
My Carrier: Verizon

Re: Data are buffered unexpectedly (socket connection)

If you want to get to the bottom of this, invest in one of this device.

http://www.riverbed.com/us/products/cascade/wireshark_enhancements/airpcap.php

Please use plain text.