`
wuhua
  • 浏览: 2114178 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

What Is - Different ways to make an HTTP or socket connection

阅读更多

Last Updated: 14 September 2009
Article Number: DB-00396

Summary

This article applies to the following:

  • BlackBerry® smartphones based on Java® technology

Procedure

The BlackBerry® Java® Development Environment (BlackBerry JDE) application programming interface (API) reference includes five ways to make a Hypertext Transfer Protocol (HTTP) or socket connection.

BlackBerry Enterprise Server using the BlackBerry MDS Connection Service

The BlackBerry MDS Services are included in the BlackBerry Enterprise Server software and handle all browser or connection requests and route the requests accordingly. Data flowing between the BlackBerry smartphone and BlackBerry Enterprise Server is encrypted with Advanced Encryption Standard (AES) or Triple Data Encryption Standard (Triple DES). A connection made through BlackBerry MDS provides seamless roaming across wireless service providers that support BlackBerry smartphone service.

By default, all BlackBerry smartphone models, except the BlackBerry® 6500 Series and the BlackBerry® 7500 Series, use BlackBerry MDS. The following is an example:

(HttpConnection) Connector.open 
   ("http://www.testserver.com");

To make sure that an application uses BlackBerry MDS Services as its connection pathway on all BlackBerry smartphone models, append the deviceside=false parameter to the end of the URL. The following URL is an example:

(HttpConnection)Connector.open 
   (“http://www.testserver.com;deviceside=false”);

BlackBerry Internet Service

Applications are also able to make connections through the BlackBerry Internet Service. This connection route is available to third-party developers and is subject to an application approval process. Data flowing over this connection is not encrypted. Hypertext Transfer Protocol over Secure Sockets Layer (HTTPS) or Secure Sockets Layer (SSL) can be used to secure a connection. A BlackBerry Internet Service connection provides seamless roaming across wireless service providers that support BlackBerry smartphone service. Currently, this transport is only available to BlackBerry Alliance Program members, subject to approval. Information about the BlackBerry Alliance Program can be found at the following web site:http://na.blackberry.com/eng/partners/alliance.jsp

Direct TCP stack

For BlackBerry smartphones running BlackBerry® Device Software 3.8 and later, a direct TCP stack is included, which allows a direct TCP connection to be opened from the BlackBerry smartphone without using BlackBerry MDS.

For BlackBerry smartphones operating on the iDEN® network, including the BlackBerry® 6510 smartphone, BlackBerry® 7510 smartphone, BlackBerry® 7520 smartphone, and BlackBerry® 7100i smartphone, a direct TCP connection is used if the deviceside parameter is not present. BlackBerry smartphones not operating on the iDEN network use BlackBerry MDS as the default connection if the deviceside parameter is not specified.

If BlackBerry MDS is not available at the time of connection, the BlackBerry smartphone reverts to direct TCP.

For the BlackBerry smartphone to use direct TCP, the user name and password fields must be completed under Options > TCP or supplied by the application. DB-00532 explains how to specify access point name (APN) information in a direct TCP connection.

To override the default behaviour of the default connection on the BlackBerry smartphone, thedeviceside parameter must be included within the connection statement. The following is an example:

(StreamConnection)Connector.open
   ("socket://testserver:600;deviceside=true");

Wi-Fi network

A Wi-Fi enabled BlackBerry smartphone is able to connect over a Wi-Fi network to the BlackBerry® Infrastructure. The BlackBerry Infrastructure exists between a BlackBerry smartphone and the BlackBerry Internet Service or BlackBerry Enterprise Server, allowing for connectivity to these components. A BlackBerry smartphone can also be configured to connect directly to a BlackBerry Enterprise Server using a virtual private network (VPN) connection over a Wi-Fi network. What this means is that applications that are making a connection through a BlackBerry Enterprise Server or BlackBerry Internet Service (options 1 and 2 ) can have their connections automatically routed through a Wi-Fi connection without any special logic required in the application. Applications can also make a connection over a Wi-Fi network directly to their destination server, bypassing the BlackBerry Infrastructure, BlackBerry Enterprise Server and BlackBerry Internet Service. To specify that a connection must be made over a Wi-Fi network, the interface=wifi parameter is used. The following is an example:

(StreamConnection)Connector.open
   (“socket:// testserver:600;interface=wifi”);

Wireless service provider WAP 1.x gateway

The connection string uses WAP parameters, which are hosted by a wireless network provider. Not all wireless service providers support connections through their WAP gateway. Contact the wireless network service to find out if support exists and to obtain a listing of their WAP gateway parameters.

The following is an HTTP connection over a WAP gateway:

(HttpConnection)Connector.open
    ("http://wap.google.com;WAPGatewayIP=127.0.0.1;WAPGatewayAPN=carrier.com.gprs");

The WAPGatewayIP and WAPGatewayAPN values are required parameters. Each parameter specified must be separated by a semicolon. The following is a table of supported WAP parameters:


Parameter Description
WapGatewayIP IP address of the gateway.
WapGatewayAPN APN for General Packet Radio Service (GPRS) networks only. For testing purposes, you can use rim.net.gprs
WapGatewayPort Gateway port value. If port 9203 is specified, Wireless Transport Layer Security (WTLS) is used unless WapEnableWTLS=false is specified.
WapSourceIP IP address of the source.
WapSourcePort Source port value.
TunnelAuthUsername User name for APN session, when Password Authentication Protocol (PAP) or Challenge Handshake Application Protocol (CHAP) authentication is used.
TunnelAuthPassword Password for APN session, when PAP or CHAP authentication is used.
WapEnableWTLS Explicitly turns on or turns off WTLS. If this parameter is not specified, WTLS is used by default for connections to port 9203.

Wireless service provider WAP 2.0 gateway

BlackBerry Device Software 4.2.0 and later includes the ability to connect through a WAP 2.0 gateway. This is done by locating the service record on the BlackBerry for the WAP 2.0 gateway and using its UID when making the connection. The following code sample demonstrates how this can be done.

ServiceBook sb = ServiceBook.getSB();
ServiceRecord[] records = sb.findRecordsByCid("WPTCP"); 
String uid = null; 

for(int i=0; i < records.length; i++) 
{
    //Search through all service records to find the 
    //valid non-Wi-Fi and non-MMS 
    //WAP 2.0 Gateway Service Record.
    if (records[i].isValid() && !records[i].isDisabled()) 
    {

        if (records[i].getUid() != null && records[i].getUid().length() != 0) 
        {
            if ((records[i].getUid().toLowerCase().indexOf("wifi") == -1) &&
                (records[i].getUid().toLowerCase().indexOf("mms") == -1))
            {
                    uid = records[i].getUid(); 
                    break;
            }
        } 
    }
}

if (uid != null) 
{

    //open a WAP 2 connection
    Connector.open(_url + ";ConnectionUID=" + uid);
}
else
{

    //Consider another transport or alternative action.
}

 

Keywords

http, socket, wap, mds, direct, tcp, Wi-Fi, APN, BES, BIS, route, connection

分享到:
评论

相关推荐

    what is mathematics An Elementary Approach to Ideas and Methods

    本书详细介绍了数学的各个分支。对于有需要了解数学方法的程序员有很大的帮助。

    GSMA-An-Introduction-to-Network-Slicing.pdf

    An Introduction to Network Slicing 1 Introduction 2 1.1 Abbreviations 3 1.2 Network Slicing: The Concept 3 2 Defining a Network Slice 4 3 The Network Slicing Blueprint 8 4 What can Network Slicing 12 ...

    ramin 2.2 for xp

    access to specific users or user groups from an NT domain. If a user logged into a WinNT domain connects to Radmin server, the user's current username/password are employed by Radmin viewer to ...

    SSD7 选择题。Multiple-Choice

    What is an identifying owner in an ER model? (a) The entity upon which a weak entity's existence depends (b) The relationship that identifies a weak entity's owner (c) The entity upon which a ...

    A-Practical-Guide-to-LATEX-Tips.pdf

    The aim of this book, is to avoid you these problems: you do not need to write everything from scratch, ask on various forums or Usenet groups, or even read heaps of books just to make a simple ...

    Senfore_DragDrop_v4.1

    to make the forms work again; Just open the forms in the IDE, then select "Ignore All" when the IDE complains that this or that property doesn't exist and finally save the forms. -------------------...

    Writing.An.Interpreter.In.Go.epub

    What's different about it, compared to other interpreter or compiler literature? - Working code is the focus. Code is not just found in the appendix. Code is the main focus of this book. - It's ...

    The Executive’s How-To Guide to Automation

    An algorithm is merely a set of rules, and anyone with the ability to envision how different components of a business can interact with other components already has the ability to work in algorithms....

    Lesson 5-Make an appointment 商务英语-约会[宣贯].ppt

    "Lesson 5-Make an Appointment" 主要关注的是如何用英语进行预约和商定会面时间。以下是一些关键知识点: 1. **电话用语**:对话中的Conversation 1和2展示了标准的电话礼仪。例如,当询问对方身份时,可以问"Who'...

    机器学习之noisy or model

    What is a Noisy-OR Model I am interested with the paper "Noisy-OR Component Analysis and its Application to Link Analysis" published by Tomas Singliar and Milos Hauskrecht on JMLR 7 (2006). A very ...

    Drupal 8 Explained: Your Step-by-Step Guide to Drupal 8

    Drupal 8 Explained is for people who want a fun and clear introduction to Drupal and requires absolutely no experience with Drupal, content management, site construction, programming, scripting, or ...

    Hi3520D_V100R001C01SPC022

    The design idea of this catalog is to fulfil the requirement that compiling the same set of source code with two different compilation tool chains. So an extra parameter to specify a specific compiler...

    Universal-USB-Installer

    software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to ...

    NGUI: Next-Gen3.0.7f1

    -An assortment of useful scripts to help you — from changing a button color to dragging an object -Simple built-in tweening system. -Clean, short, simple and extensively optimized C# code -No DLLs or...

    计算机网络第六版答案

    27. Creation of a botnet requires an attacker to find vulnerability in some application or system (e.g. exploiting the buffer overflow vulnerability that might exist in an application). After finding ...

    wireshark抓包实验之TCP

    To answer this question, it’s probably easiest to select an HTTP message and explore the details of the TCP packet used to carry this HTTP message, using the “details of the selected packet header ...

    apache-maven-3.3.9.rar

    4) Make sure JAVA_HOME is set to the location of your JDK 5) Run "mvn --version" to verify that it is correctly installed. For complete documentation, see ...

    HTML - Beginners-Guide-to-HTML - Michael Gabriel

    1. Getting Started: What You Need to Do to Get Going and Make Your First HTML Page 1.1 What is HTML? 1.2 Why learn HTML? 1.3 What you need to know about HTML to get started 2. Tags, Attributes and ...

    rfc全部文档离线下载rfc1-rfc8505

    Very little of what is here is firm and reactions are expected. I. A Summary of the IMP Software Messages Information is transmitted from HOST to HOST in bundles called messages. A message is ...

Global site tag (gtag.js) - Google Analytics