There are multiple routes an application can use to create a socket or Hypertext Transfer Protocol (HTTP) connection on a BlackBerry smartphone:
Through the BlackBerry® Mobile Data System (BlackBerry MDS) on the BlackBerry® Enterprise Server
Through a direct Transmission Control Protocol (TCP) connection
Through the service provider’s Wireless Application Protocol (WAP) gateway
Using a Wi-Fi® network
For more information on these connection types, see this article.
When a BlackBerry smartphone is in a Wi-Fi coverage area, it can route connections made through a BlackBerry Enterprise Server or the BlackBerry® Internet Service over the Wi-Fi network. This uses one connection from the pool available to make Wi-Fi connections.
BlackBerry MDS connections
For the BlackBerry smartphone, there is no maximum number of connections that can be made over BlackBerry MDS.
For the BlackBerry Enterprise Server, BlackBerry MDS 4.0 supports up to 200 simultaneous connections. By default, BlackBerry MDS 4.1 supports up to 2000 connections (this value is configurable in BlackBerry MDS 4.1).
These limits relate to the total number of connections by all BlackBerry smartphone users making BlackBerry MDS connections through third-party applications or when using the BlackBerry® Browser.
Direct TCP, Wi-Fi, and WAP 2.0 connections
Direct TCP, Wi-Fi and WAP 2.0 connections have a shared connection pool. BlackBerry® Device Software 4.5.0 and later supports 32 simultaneous direct TCP, Wi-Fi or WAP 2.0 connections. For BlackBerry Device Software versions earlier than 4.5.0, the limit of connections is five. These can be either socket or HTTP connections.
This is cumulative for all applications running on the BlackBerry smartphone. When the specified maximum number of direct TCP connections are open and an application attempts to make another, the java.io.IOException: Max connections opened exception is thrown.
An application should limit the number of direct TCP connections in use, and close connections that are not in use to free these resources for other applications. See this articlefor sample code demonstrating how to correctly close a connection.
BlackBerry Device Software versions earlier than 4.7.0 support eight file handles per file system. This means there are eight file handles available to access the microSD card and eight file handles that can be used to access internal memory. BlackBerry Device Software 4.7.0 and later allow for 16 file handles that can be used for any file system. Each stream makes use of a file handle. If you open both an input and output stream on the same file, you will be consuming two file handles. If you are seeing a lot of issues around an inability to open a FileConnection it may be that your application is leaking file handles by not correctly closing them. See this article for sample code demonstrating how to correctly close a connection.