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
AndriyBorysov
Posts: 4
Registered: ‎02-27-2012
My Device: 9700

ConnectionFactory floods server

Hi,

 

I'm using net.rim.device.api.io.transport.ConnectionFactory for connecting to own server using socket. The factory configured with default settings. All transports are preffered, except WAP, BISB configured as public.

The problem is the follows: device tries to establish a connection to server, in sniffer on server-side I see that the device sends multiple 'connect' TCP packets to server with delays 2,2,4,4,8,.. seconds between the packets. Server sends 'accept connect' TCP packet in response on each packet from device, but device continues trying to establish a connection.

It happens sometimes, not always. It happens via stable wifi and via cellular transports. It happens on different server implementations and hostings. It happens on different devices (9700, 9800, 9360) and OSes (5.0, 6.0).

On server, the problem gives exception after device accepting - kind of "socket already closed".

 

My expectation that device won't try to connect after it receives 'accept' from server.

 

Has somebody any thoughts about the problem? Thank you for your help. 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: ConnectionFactory floods server

welcome to the support forums.

Can you check if this only happens with the connectionfactory?
As far as i understand BB the underlying framework takes care of connections, i doubt that the connectionfactory itself is responsible for the retries (but i don't know its source)
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
swap_chau
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550

Re: ConnectionFactory floods server

Is your connection timeout is too low?
New Contributor
AndriyBorysov
Posts: 4
Registered: ‎02-27-2012
My Device: 9700

Re: ConnectionFactory floods server

Thanks for replies.

 

First about timeout: originally it was 30 seconds, then I leave it for system, i.e. use default settings (except preffered transports) .

 

I checked with "interface=wifi" and the problem still reproduced. Also I noticed that BB browser floods HTTP server (apache) on the same computer. But the browser fails to connect within several seconds and HTTP server doesn't accept the connection. I mean apache gracefully handles the floods.

 

Both tried server implementation use C# framework. 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: ConnectionFactory floods server

What BlackBerry Smartphone model and BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.

 

Do you see this when you first attempt the connection or while the connection is active?  The ConnectionFactory will attempt connections to the server using the various transport routes to determine which ones are available.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Contributor
AndriyBorysov
Posts: 4
Registered: ‎02-27-2012
My Device: 9700

Re: ConnectionFactory floods server

Currently I have access only to 9700, version is 5.0.0.442 (platform. 5.1.0.121).

 

I have a test app, that connects every 10 seconds to server. The problem is reproduced randomly. Sometimes on first connection. Sometimes after few minutes and after few attempts connection succeeds, but then it fails again.

 

But I already suppose that it's a server related issue, and caused by BB device. I think so, because MS Windows Socket (winsock2) implementation accepts a connection even TCP 'three-way handshake' has not completed yet.

 

When I confirm it, I will close this topic.